I have an input element listening to an event, how do I pass the value of the input to a React State?
const [business, setBusiness] = useState('Value should be entered here')
<input placeholder="Search Businesses" onChange={"pass the value"}/>
I have an input element listening to an event, how do I pass the value of the input to a React State?
const [business, setBusiness] = useState('Value should be entered here')
<input placeholder="Search Businesses" onChange={"pass the value"}/>
2
Answers
Something like that:
One can set value in useState by setting event value like this :