How do I conditionally add attributes to React components?
Apparently, for certain attributes, React is intelligent enough to omit the attribute if the value you pass to it is not truthy. For example: const InputComponent = function() { const required = true; const disabled = false; return ( <input type=”text” disabled={disabled} required={required} /> ); } will result in: <input type=”text” required> Update: if anyone … Read more