I'm trying to give a value of the props note to the TextField but if I use TextInput the result is undefined and if I use the note props, I cannot change the value of the TextField afterward.
When I console log both of the value, they render twice as shown in the image.
I tried useEffect also to set the state.
export default function ProfileNote({ contact }) {
const { note, id } = contact;
const [textInput, setTextInput] = useState(note);
console.log(`textInput: ${textInput}`)
console.log(`note: ${note}`)
const handleTextInputChange = event => {
setTextInput(event.target.value);
};
return (
<FormProvider onSubmit={handleSubmit(onSubmit)}>
<TextField
name="notes"
label="Notes"
onChange={handleTextInputChange}
value={textInput}
/>
</FormProvider>
);
}
Image of the console.log
Thank you.
