Closed
Description
Hi,
I created a codesandbox to demonstrate the issue: https://codesandbox.io/s/valtio-simple-counter-forked-17yos?file=/src/App.js
Given a state like:
const state = proxy({ arr: ["hello"] });
Then accessing the array like so:
const list = useProxy(state.arr);
I would expect the component to rerender when I do something like this:
const handleClick = () => {
state.arr = ["hello", "world"];
};
However, it doesn't update.
It does update if I mutate the list like this: state.arr.push("world");
.
But assigning a whole new array doesn't cause an update.
Am I just misunderstanding how it's supposed to work or is this a bug?
Thanks!
Metadata
Metadata
Assignees
Labels
No labels