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
I was playing with the examples to understand the internal code flow of React's setState.
I noticed that ReactCompositeComponentWrapper Object had reference to _instance Object which in turn had reference to the same (screenshot's console) ReactCompositeComponentWrapper Object as _ReactInternalInstance. Is that an expected structure ?
The text was updated successfully, but these errors were encountered:
Yes, it is intentionally a doubly linked structure. ReactCompositeComponentWrapper is an internal only and wraps user-defined composite components. It holds a reference to the instance of the user-defined component that is defined when it is mounted. Then ReactInstanceMap is used to store a reference to the internal wrapper on the public instance.
If you look at ReactInstanceMap it has some more information in the doc comments
ReactInstanceMap maintains a mapping from a public facing stateful instance (key) and the internal representation (value). This allows public methods to accept the user facing instance as an argument and map them back to internal methods.
I was playing with the examples to understand the internal code flow of React's setState.
I noticed that ReactCompositeComponentWrapper Object had reference to _instance Object which in turn had reference to the same (screenshot's console) ReactCompositeComponentWrapper Object as _ReactInternalInstance. Is that an expected structure ?
The text was updated successfully, but these errors were encountered: