Code
export default function Header(){
let showMe = false;
function toggle(){
showMe = !showMe;
}
return (
<>
<button onClick={toggle}>Toggle Subjects</button>
{/*The bottom code should toggle on and off when the button is pressed*/}
<div style={{
display: showMe?"block":"none"
}}>
This should toggle my display
</div>
</>
);
}
Expectation
The div tag should toggle in visibility (For example, if I clicked on the button once, the div tag should show up, and if I clicked on it again it would be hidden and so on).
Reality
It appears the variable showMe changes however the div tag does not follow with the updates and remains hidden.
NOTE: I am using next.js if that changes anything.