As with any function, it can be exited early with return
keyword.
These two snippets are equivalent:
React.useEffect(() => {
if (foo){
// do something
}
})
React.useEffect(() => {
if (!foo){
return;
}
// do something
})
As with any function, it can be exited early with return
keyword.
These two snippets are equivalent:
React.useEffect(() => {
if (foo){
// do something
}
})
React.useEffect(() => {
if (!foo){
return;
}
// do something
})