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
The DOM renderer is the only one currently using prepareUpdate. It allows React to compute the new props to apply separately from applying the diff (commit). This is useful for pausing and resuming work. The other renderers compute the diff during reconciliation.
It was added in #8607 which has substantially more information on the motivation and use case.
The other renderers compute the diff during reconciliation.
Not sure what you meant by this—prepareUpdatedoes fire during reconciliation. We compute updates during reconciliation but don’t commit them yet. This makes it possible to split reconciliation across frames. Then we commit the whole tree at once when it is ready.
The official renderers seem to generally return a
const
of{}
in prepareUpdate, for example here: https://github.com/facebook/react/blob/master/src/renderers/art/ReactARTFiberEntry.js#L493While the tutorial at https://github.com/nitin42/Making-a-custom-React-renderer/blob/master/part-one.md suggests to return
true
What is the nature of the return type from
prepareUpdate
and how does it affectcommitUpdate()
?The text was updated successfully, but these errors were encountered: