Call a state change for a different component


#1

Hi. I want a button on one page to change the state of a different component. Can this be done by scripted as I can’t see that option under onclick action? (option to change a state in the existing page is there). The samples i have found have been this.setState but I would need something like [component_name].setState


#2

Hi, you can do this several different ways. I would recommend you to set the embedded component’s state via Data slot. Then you can simply change the state index value in data slot anywhere in the app and the component state will update accordingly the value in state.

Another option is to use Interaction: In element -> Change content -> component to state but this may cause conflicts if you want to change the component state also inside the component.

Here’s a preview link for my example “app”: https://neonto.cloud/preview/rbgpqyvm