Search code examples
javascriptreactjsredux

how to import child's state to parent component


I want to import the child state to my parent component in order to change DOM, but I don't know if its possible or how to do it shall I use Redux in this case ?? if not what possibly I must do to do that


Solution

  • You can create state in parent component and pass it to child component (state and setState) via props. In this case, the parent and child components will be able to use this state.