How to get previous value in signals? #309
Answered
by
rschristian
ganjarsetia
asked this question in
Q&A
-
When I'm using const [object, setObject] = useState({
firstKey: '',
secondKey: '',
});
setObject((prevState) => ({
...prevState,
secondKey: 'value',
})); Ho to do like this using signals? |
Beta Was this translation helpful? Give feedback.
Answered by
rschristian
Feb 27, 2023
Replies: 2 comments 1 reply
-
It's just normal JS, no need to do anything special: const myObject = signal({
firstKey: '',
secondKey: '',
});
myObject.value = { ...myObject.value, secondKey: 'value' }; |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ganjarsetia
-
So I actually started a fork with pr to add a history array for previous values. |
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
It's just normal JS, no need to do anything special: