Answers for "changing parent function states in child function"

0

changing parent function states in child function

function Parent() {
    const [value, setValue] = React.useState("");

    function handleChange(newValue) {
      setValue(newValue);
    }

    // We pass a callback to Child
    return <Child value={value} onChange={handleChange} />;
}
Posted by: Guest on March-20-2021

Code answers related to "changing parent function states in child function"

Browse Popular Code Answers by Language