View Tree Duality
github.com
github.com
Without an independent notion of lifecycle, React essentially cannot improve it’s reconciliation algorithm.
if (someCondition) {
return <div><Thing /></div>
} else {
return <Thing />
}
will result in `Thing` going through the unmount / re-mount portion of the component lifecycle every time `someCondition` changes. This proposal suggests that instead `Thing` should remain mounted. It has been suggested (in the linked issue https://github.com/facebook/react/issues/16316) that there is a plan to make this possible at some point via something termed "re-parenting".In the time leading up to its release, I am releasing a series of documents explaining core ideas.