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
constbecause you're not reassigning thejsxvariable, just pushing into the array that it points to: