Is there a way to get the diff that React is getting of the DOM/Components? I can imagine trying to store changes as they happen so the user can 'undo' the changes [and am personally interested in the availability of the diff that is underlying the rerender (perhaps it would have the components that have changed?)].
EDIT: The undo feature was just an example. I am just interested in whether the above is possible to extract from React, since it is supposedly doing a diff of new and old tree.
I'm trying to store changes as they happen so the user can 'undo' the changes
My proposition how to accomplish this:
React render result should be based only on states. If you give two times identical state, then DOM should be identical. Possibly child components should be stateless.
componentWillUpdate
method is run after changes in props and states.
You can copy and save state after any state change.
And if user 'undo' changes then set old saved state as current state.
And DOM should be identical to previous state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With