Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sharing State Between Custom Messages #188

Open
jebberwocky opened this issue Apr 29, 2024 · 1 comment
Open

Sharing State Between Custom Messages #188

jebberwocky opened this issue Apr 29, 2024 · 1 comment

Comments

@jebberwocky
Copy link

jebberwocky commented Apr 29, 2024

Can we share the state between custom messages?

scenario:

  • there are 2 custom messages A and B and
    customMessages: { a: (props) => <A {...props} />, b: (props) => <B {...props} />,

  • there is a state const [isLoaded, setIsLoaded] = useState(false); in A

  • like to share const [isLoaded, setIsLoaded] = useState(false); from A to B

  • B can call setIsLoaded

thanks

@zmoshansky
Copy link

Try looking into:

const {state} = props;
Then assign values into state, 

Or in ActionProvider, use the setState fn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants