Given the following in React:
const [name, setName] = useState('');
useEffect(() => {
console.log(name);
}, []);
return (
<Button onClick={() => { setName('Jack'); }>
{name}
</Button>
);
What happens when you click the rendered button?
Button
will change to Jack
.Button
will change to Jack
and will print Jack
in the developer console.