-
Notifications
You must be signed in to change notification settings - Fork 47.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get object tree presentation of components tree before initial render? #3244
Comments
Why do you need this? |
I'm experimenting with a concept of global state object, where it should be programmatically constructed to represent hierarchy of components tree. Thus it's easier to pass state as props from root component down the tree. |
Not sure what you mean. Can you give a code example of the problem you're trying to solve? |
Related, is there a way to traverse the render tree before rendering? Does it do ahead of time tree traversal pulling the |
@iamdustan yeah, this is somewhat my question. |
Closing as the tree is considered an implementation detail. |
@gaearon Is it possible to have React without a component tree? Could you reconsider, please? Public API for a component tree traversal would allow writing (de)serializers to rehydrate without resorting to a global state. |
We’re aware of use cases—please see #4595 for a place to discuss this. Right now we’re in the middle of a React rewrite (https://www.youtube.com/watch?v=aV1271hd9ew) so it's not a very good time for us to expose any internals. |
One way I've found is to apply a mixin to every component which takes
_rootNodeID
, treat it as path and construct an object. But_rootNodeID
includes ids not only of React components, but elements as well.The text was updated successfully, but these errors were encountered: