I am using a in a react native functional component and onChange the state does not seem to be updating for "name".
I am console logging the new state using useEffect to check whether or not the state is updated and it is returning undefined as if the input text was never set as the state "name"
function AddTask () {
const [name, setName] = useState('');
useEffect(() => {
console.log(name),name;
})
const updateTaskInfo = event => setName(event.target.value);
return (
<TextInput
onChange={updateTaskInfo}
placeholder="Name"
value={name}
/>
);
}
export default AddTask;