According to this clean-code guide you should encapsulate conditionals:
function shouldShowSpinner() {
return fsm.state === 'fetching' && isEmpty(listNode);
}
if (shouldShowSpinner()) {
// ...
}
Why not just write:
const shouldShowSpinner = fsm.state === 'fetching' && isEmpty(listNode)
if (shouldShowSpinner) {
// ...
}