I have three components each one being a parent of the other. I want to render the entire parent component upon clicking a child component. What is the correct way to achieve this?
You can update state of parent component from child component. Parent will then re-render automatically.
Or
You can pass forceUpdate
method of parent component as a prop to child component. Whenever child component will call that method (eg on onClick handler), parent will re render.
Reference:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.