If you need to have a variable that you can mutate and maintain the value of across renders (e.g. popup here) React has a hook called useRef. It's designed for values that you don't want to recreate on every render—kind of like opting out of the state-based render cycle.
So this
const popup = React.useRef(null);
// ...
console.log(popup.current)
If you just use a normal variable like you've got then it'll get recreated whenever this component re-renders, which you probably don't want.
week10-Joe-Ivo/src/components/log-in.js
Line 6 in 22b8511
If you need to have a variable that you can mutate and maintain the value of across renders (e.g.
popuphere) React has a hook calleduseRef. It's designed for values that you don't want to recreate on every render—kind of like opting out of the state-based render cycle.So this
If you just use a normal variable like you've got then it'll get recreated whenever this component re-renders, which you probably don't want.