Bootstrap classes do not work in ReactJS component Bootstrap classes do not work in ReactJS component reactjs reactjs

Bootstrap classes do not work in ReactJS component


In React, the attribute is className, not class. So for example, rather than having

<div class="panel panel-default">

You should instead have

<div className="panel panel-default">

By setting it as class, React ignores that attribute, and as a result the generated HTML doesn't include the classes the CSS needs.

If you run your expected HTML through the compiler, that is indeed what you get.enter image description here


I had a similar issue when following a React tutorial, i was writing

<div classname="my bootstrap code here"> 

instead of

<div className="my bootstrap code here">

className should be in camel case for jsx. Hope this helps :).