Replies: 2 comments
-
You are mutating the stored object and setting it back, so it should not trigger an update because change is not perceived as update. Try setting a new object: setStore(({id, ...rest }) => rest); |
Beta Was this translation helpful? Give feedback.
0 replies
-
If the stored data is an array, Is it only detecting a change when the reference to the array is changed? If I want to change an element of the array, is the only way to make the array re-render in by making a new one? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello, this is a two part question that may be linked together and can be resolved at once.
So I have some utility function to create a store object and to save it on localStorage.
As you might see I am registering an effect to trigger the save mechanism of the object when it is altered via
This works well when I alter any values in the store.
__
But it does not get triggered seemingly when I delete a value in the store.
For example like so:
Any possibility to trigger my effect when deleting a value from the store?
Part 2 of the question:
Is that even the correct way to delete somethign from the store
I am getting typescript errors when trying to do
Edit:
For the time being to solve problem 1 I am using this now instead of effect, although it gives me a typescript error for the spread operation:
Beta Was this translation helpful? Give feedback.
All reactions