React tip: With boolean props, prefer a false default


React tip: With boolean props, prefer a false default.

Example of hiding a legend, defaulted to visible:

<Fieldset showLegend={false} /> 👎

<Fieldset hideLegend /> 👍

In JSX, existence = true.

So a false default results in more concise JSX. 😎

#reactjs

View original on X