'className' instead of 'class' within JSX markup
See original GitHub issueHi,
Is there anyway we could add a rule that lets you lint for the use of the ‘class’ field when it should be ‘className’?
ex:
render () {
console.log('Render');
return (
<div key={this.props.id} class='bookListItem'>
<p>{this.props.title}</p>
<p>{this.props.description}</p>
</div>
);
}
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Why React uses className over class attribute
Explanation: The only reason behind the fact that it uses className over class is that the class is a reserved keyword in JavaScript...
Read more >class vs className in React 16 - Stack Overflow
class is a keyword in javascript and JSX is an extension of javascript. That's the principal reason why React uses className instead of ......
Read more >'className' instead of 'class' within JSX markup #186 - GitHub
This is an error, but no-unknown-property won't catch it because it isn't a DOM element. Is there a blanket way to flag all...
Read more >Why do I have to use 'className' instead of 'class' in ReactJs ...
JSX is just the description of HTML in strings, with curly braces {} to embed JS values. Because it is parsed by JavaScript,...
Read more >class vs className - Learn React - Codecademy
This is because JSX gets translated into JavaScript, and class is a reserved word in JavaScript. When JSX is rendered, JSX ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, if you want a rule to forbid invalid html props based on the element type, we’d need a different rule.
Cool, opened #1990