I've been trying out React on a project for weeks now. And I just remembered that I should use className
instead of class
in regular DOM and SVG, because class
is a reserved keyword in JS.
However, all my components are using class
so far. For example:
export default class Header extends React.Component {
render() {
return (
<div class="Header">
<img class="Logo" src="./interface/images/ea-white.png"/>
<h1 class="Title">{this.props.title}</h1>
</div>
);
}
}
Why haven't I got any syntax error? Does React DOM have to use className
? What could happen if I keep it this way?
Edit: Yes, the CSS files worked normally all this time. There's no warning in my console (which is weird).