Warning: Unknown DOM property class. Did you mean className?
In React.js there is no for and class properties available so we need to use
for --> htmlFor
class --> className
Yes, its a React convention:
Since JSX is JavaScript, identifiers such as
class
andfor
are discouraged as XML attribute names. Instead, React DOM components expect DOM property names likeclassName
andhtmlFor
, respectively.
JSX In Depth.
Meteor uses babel to transpile ES5 to ES6 (ES2015), so we can deal with it as a normal Node application with babel transpiler added.
You need to add .babelrc
file to your project's root folder, and add the following items
{
"plugins": [
"react-html-attrs"
]
}
And of course, you need to install this plugin using npm
:
npm install --save-dev babel-plugin-react-html-attrs