-
If you want to run the event listener callbacks onSet when the value is the same as the previous value, what's the best way of doing that? The cleanest way I've come up with now, onSet($atom, ({ newValue }) => {
if (newValue === $atom.get()) {
//@ts-expect-error - notify is not exposed in the types
$atom.notify(newValue);
}
}); Would it make sense to expose the notify method in the types, like what's done with value? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
There is a problem with React and some other frameworks requires change in the value. The hacky way is to keep value inside the object and change the object: $atom.set({ value }) |
Beta Was this translation helpful? Give feedback.
OK, send PR with a notice.