How to deserialize stored state snapshot?
AllNamesRTaken last edited by
I am new here and I am building a VTT (virtual table top) where I store the board state on room dispose as JSON.
On create I would like to deserialize it into the new state.
Is there a quick way of doing it or do I need to nest constructors to consume the object?
Hi @AllNamesRTaken, welcome! 👋
You should be able to do the following:
const snapshot = this.state.toJSON(); // ...store snapshot JSON into the database // ...let's restore the snapshot this.state.assign(snapshot);
Let me know if that works for you!