-1

I picked up a react project that uses className={css.someStyle} format to link css to components. The problem is that I installed a package and I cannot get any css from it because my app only takes className how I showed you above, and the package, i saw, uses className="some_style" format. How can I make my app accept className="some_style" format ?

Bogos Robert
  • 193
  • 2
  • 9
  • I don't understand. Please edit the question if you can. Double the amount of text. Put all infos in which you have. Make multiple text block with headings like `# Problem`, `# What I did` and `# Question` for example. – qräbnö Mar 20 '21 at 20:52
  • Pro tip for the future: screenshots or images! – qräbnö Mar 20 '21 at 20:54

1 Answers1

0

If the information you are giving is correct the app is using CSS modules. That is why you see className={something.something}. className by default uses two different ways to take a class.

  1. className="string" - the string can be any format like 'string-string', 'string__string' or something else. Do know that if you have a string separated by space it becomes two different classes.
  2. className={variable} - with this syntax you can pass variable, css modules and expressions between the curly brackets.

To answer your question: Nothing should be preventing you from using the synthax className="some_style". Just be sure you are not surrounding the string with {} like className={"some_style"} because this will not work.

voxtool
  • 345
  • 4
  • 11