You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment, whenever a particular branch of a layout is
updated, all the state (i.e. hooks and event handlers) that
live within that branch are thrown away and reconstructed.
Given IDOM’s current implementation for Layout this is
unavoidable. To resolve this issue, we need to add a concept
of “keys” which can be used to indicate the identity of an
element within the layout structure. For example, if you have
a list of elements that get re-ordered when a button is
pressed, their state should be preserved, and reassigned to
their new location in the layout.
By default React requires keys to be used to communicate
element identity whenever the order or number of simbling
elements can change. While there are clear performance
benefits for adhering to this stipulation, it’s often
confusing for new developers. React has the further advantage
of the JSX syntax, which makes it easier for the program to
determine exactly when keys must be supplied by the user. To
make the experience for new users simpler, and due to a lack
of inforcement via JSX, IDOM will be to assume that any
element without a key is new. Thus, for IDOM, keys will
primarilly be a tool for optimization rather than a functional
requirement.
0 commit comments