Is there a special way to reassign let
within conditional statement to avoid keep getting prefer-const
eslint
error?
My code:
let jsx = [];
if (a === b) {
jsx.push(
<div>
xxx
</div>
);
}
jsx.push(<div>yyy</div>);
=== UPDATE === Sorry for the confusing, actually it is not a reassign operation.
You can use
const
because you're not reassigning thejsx
variable, just pushing into the array that it points to: