Search code examples
javascriptcssreactjscss-modules

Normal string className in CSS module


Is there any way to write normal type className on React using css module. Like I want to write className="Foo Bar" avoiding className{ ${foo} ${bar} of CSS Module.


Solution

  • className="Foo Bar" When you inspect the element then you can notice, the element has assigned the class Foo and Bar.

    The way CSS module works, if you are assigning class Foo on any element, then you can inspect it has been assigned class like, Foo_asd113d3__random_string.

    That's why className="Foo Bar" will not work in CSS module