Here, the memo makes all of its downstream objects react on every mousemove event because the memo is an object whose reference gets recreated, similar to a signal.
Question 1
Is there a store-like version of a memo which automatically memoises each field of an object such that it won't make downstream objects react unless there is a change in a value?
Question 2
If there is no such structure as asked above, which of the following work-arounds would be a better choice and why?
Say there is a store named
mousePosition
which contains an adjusted version of the mouse location which gets updates on themousemove
event.My goal is to create a memo which has a discrete version of the position such as the following:
Here, the memo makes all of its downstream objects react on every
mousemove
event because the memo is an object whose reference gets recreated, similar to a signal.Question 1
Is there a
store
-like version of a memo which automatically memoises each field of an object such that it won't make downstream objects react unless there is a change in a value?Question 2
If there is no such structure as asked above, which of the following work-arounds would be a better choice and why?
Choice 1
Choice 2
Here is a playground link illustrating the question: https://playground.solidjs.com/anonymous/a847c828-eab8-4ccb-a9af-789afdf45f18