1. Create a function in the parent component which must have the state which is getting updated from the child 2. Context api 3. Redux statemangement
1) useContext 2) Redux state management 3) usecallback 4) through props
Function parent() { Return <child name="hello"> } Function child(props) { Return<p >welocom, {props.name}<p/> }
Function mycompo(){ Return<child name ="react"> } function child (props){ Return<h1>this is ,{props.name}<h1/> }
By defining a function in the parent and passing that as a prop to child then in child component we invoke the function by passing data to the function call
1. Lifting state using callbacks 2. Context api -- global state 3. Solutions like redux or zustand -- global state
Using Context API, using Redux
With function props. Just send data as parameter. With function prop the state of the parent can be managed from child components.
1.prop drilling 2.context api
You can use hooks like useContext or useState or call back functions
Using chatgpt
Define a function in parent who takes parameter which in turn updates something based on paramater value change. Now pass this function as prop to child. Child updates parameter and hence we send data from child to parent.
Use the callback function
We can achieve that by using callbacks
We can create use either context or we could use the react forward ref and imperative hook of react.
by using context
By using context api
Props
By using state
@ajaychaudhari599