score:0

Accepted answer

remove id and oninput from useeffect sensivity list

useeffect(() => {
        oninput(id, inputstate);
}, [inputstate]);

and set default value of inputstate to '' as follow:

const [inputstate, setinputstate] = usestate('');

to prevent 'a component is changing an uncontrolled input of type text to be controlled error in reactjs'. also you can init formstate:

const [formstate, setformstate] = usestate({title:'', focus:''});

Related Query

More Query from same tag