Render parent component from child component
See original GitHub issueBackground and Motivation
@javiercn say I have a component (Foo
) currently displayed on a page. Then I decide all instances of Foo
should be rendered inside a container (<div>
). Do it manually sounds great when Foo
is just being used few times, but not ideal if usability is high. Then, I create a Parent
component to render the container and I make Foo
to inherit Parent
. The idea is any time Foo
is rendered it should also render the parent it inherits from.
The big question is, Is this possible today? The way BuildRenderTree
works is forward only (if I’m not mistaken), thus it renders parent then child. I haven’t seen child then parent.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How to re render parent component when anything ...
To rerender the parent you have a couple options: you can change parent's state(triggering an update) or you can forcibly trigger an update....
Read more >In React, how do you re-render a parent from a child ...
In React, re-rendering a parent component from a child component involves using a combination of state management and props. However, it's important to...
Read more >The mystery of React Element, children, parents and re ...
Looking into what is React Element, exploring various children vs parents relationship in React, and how they affect re-renders.
Read more >How to pass data from child component to its parent in ...
In the parent component, create a callback function. · Pass the callback function to the child as a props from the parent component....
Read more >Re-render Parent Component : r/reactjs
Re-render Parent Component · Either place and handle all functionality from you parent component by passing them through the props. · Or manage...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Create a question on StackOverflow explaining what you want to achieve (not how you are trying to achieve it) and post a link here
This issue has been resolved and has not had any activity for 1 day. It will be closed for housekeeping purposes.
See our Issue Management Policies for more information.