Restoring persisted state with useMachine
hook not working
#1540
Unanswered
GeospatialMax
asked this question in
Q&A
Replies: 1 comment 5 replies
-
Please create a CodeSandbox (React template) for this. Thank you! |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all, currently experimenting with restoring a persisted state into a machine using the useMachine hook, but for some reason the state doesn't seem. to be restoring correctly.
Here's the code
MapState is passed in as a prop and can either contain previously persisted state (when the machine was spun up before) or be empty. If we have previously existing state I am parsing it back to an object from the string and pass it into the useMachine hook along with the other machine options.
But the machine nonetheless spins up with the default state. Am I missing something?
Beta Was this translation helpful? Give feedback.
All reactions