Search code examples
javascriptreactjsfrontendredux-toolkitreact-context

Do React Context like useState , In the treatment of the components, each one is treated separately ,


I have a form component and i need to use react context to manage and validate each input seperetly because i build an input component, and i build a component contain information from the form component , can react context treat each input individually or not , or use redux

Do React Context like useState , In the treatment of the components, each one is treated separately or not


Solution

  • React context is in fact passing data with props through multiple level but without the need of implementing this. so in your case it is like you pass the whole state in which you store the inputs to each child component and use it there.

    better is to pass to each child component directly as props the data it needs.