How to get snapshot value from store
Hi,
I currently have the following problem. I try to create a file and need values from a Store for this. Here some code:
The store
state/list-state.js
A button components/Actions.jsx
The file parser utils/file.js
The problem now is, that parseFile(listState.list);
ends in me getting a Proxy object, that is what my browser console is reporting, instead of the wanted array list
. When I try to access it, I only get undefined
back. And now I don't understand how to get something like a non-reactive snapshot of the value from the store object, that I can use as a parameter for the parse function. Or what is happening here, why is it undefined 😵💫3 Replies
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
You can use
unwrap
on the store object before you pass it to parseFile
to get the object without the proxy
parseFile(unwrap(listState.list))
Thanks, unwrap did it 😄
But I think I will also take a look at context, looks also promising