In react.js I want to use a css style like this
<button class = "btn btn-primary"> A Button </ button>
import style1 from './style.css'
return <button className = {s['btn btn-primary']}> A Button </ button>;
How do I do it?
In react.js I want to use a css style like this
<button class = "btn btn-primary"> A Button </ button>
import style1 from './style.css'
return <button className = {s['btn btn-primary']}> A Button </ button>;
How do I do it?
Well you can just simply place the classes as a string, like this:
<button className="btn btn-primary"> A Button </ button>
or if you have complex classes with logic, you can use this great package:
https://www.npmjs.com/package/classnames
<button className={classNames({ foo: true, bar: false })}> A Button </button>
this will result to this html:
<button class="foo"> A Button </button>