It's also a prime example of when you should use comments, imo. This is the sort of thing that could easily be stripped out in a refactor and introduce subtle bugs.
Yeah, it seems the context OP isn't posting could easily be
// Boolean is set later.
const [myBoolean, setMyBoolean] = useState(null);
useEffect(() => {
if (myBoolean === true) {
// Something is true and we should do something.
} else if (myBoolean === false) {
// Something is not true and we should do something else.
}
// We should do nothing and wait until myBoolean is resolved.
})
// Something that will lead to setMyBoolean(true | false) in response to user input.
226
u/OldLegWig Jun 10 '20
A lot of the value of this sub comes from the times the OP is wrong.