What i'm trying to do
I want to go through one array, create another array that represents mapping by index, save it in Local Storage
, and then when the app first mounts to check if there is a value stored in Local storage
, and if so then sort the array of data coming from the store (as Proxy
) So that they are displayed according to the mapping in LocalStorage
.
Hope the explanation is clear :)
I got the data from store as a Proxy
like so:
const chocolates = machineStore?.SubsystemsInfo
when i console it out, i need to stringify and parse it so i can view it in the console. it look like so:
When the component mounts, i get the array of mapped indexes from LocalStorage,
but the problem now is that i need to render the original array based on it and i cant because it's a
Proxy and i can
t get access to the array itself, so i can then sort.
how can i convert the data to a regular array so i can work with it ?
i already tried spreading, and parsing so it brings am empty array.
any ideas what do i miss?
Thanx