DEV Community

loading...

Discussion on: How to sync props to state properly in React Hooks

Collapse
paramharrison profile image
Paramanantham Harrison Author

Thanks Kim, I understood, this example doesn't make much sense. It was created just to showcase how to sync props to state if there is a need for internal state change without the props change.

Example in a tabbed layout where you already have the data as props, but the current tab has internal data changes which are not used outside. In this case, there is no need to lift the state to parent but can be managed inside the tab and have props as the initial state.