Closed
Description
React will issue a warning in dev if you pass a non-object to the style
prop on DOM element tags
This should be easy enough to enforce for most cases with a linter rule.
Bad:
<div style="foo" />
<div style={true} />
const styles = true;
<div style={styles} />
Good:
<div style={{ color: 'red' }} />
const styles = { color: 'red' };
<div style={styles} />
It would be even nicer if it validated that the values of the style object are all strings.