-
-
Notifications
You must be signed in to change notification settings - Fork 266
How valtio works
Daishi Kato edited this page Jul 14, 2021
·
11 revisions
This is to try describing the high level abstraction of valtio.
Suggestion notes:
- Starting with
useSnapshot()
what proxies are created and what are their conceptual names? Briefly, how isuseMutableSource()
source used to setup the subscription? It looks like there are listeners on a proxy, for deep property changes, how are those stored and tracked? What will trigger the subscription to be fired? Be detailed here. - Walk through the flow of a property change for something non-trivial like
address.person.name = "Bob"
Step-by-step, from the moment of the assignment, what happens? How is the change notification queued? Is it through a React hook? When the change notification actually occurs, how is a re-render triggered? Leave no stone unturned as this is a very complicated interaction.