Update React state when xState context is changed! #1393
-
I am trying to re-render a React component when state.context is changed, how can I tell React, your state is changed, useSerivce and asEffect might be a solution. I tried to execute them but they return errors. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
@Ali-Hussein-dev Could you send through a code sandbox or code snippet of what you're trying to accomplish? |
Beta Was this translation helpful? Give feedback.
-
React components will rerender if the |
Beta Was this translation helpful? Give feedback.
-
Probably my implementing it not correct. |
Beta Was this translation helpful? Give feedback.
-
Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given and in your case there are none. |
Beta Was this translation helpful? Give feedback.
-
Sorry for inconvenience. here is a Codsandbox demo. |
Beta Was this translation helpful? Give feedback.
Sorry for inconvenience. here is a Codsandbox demo.
https://codesandbox.io/s/demo-r382r?file=/src/App.js