0

Currently, in React I write my css in css modules. However, I also use the font-awesome library which uses normal css.

So my question is there is a way to use a normal css and css module on the same selector?

<i className={classes.icon} + "far fa-user" />

2 Answers 2

3

Thanks to ES6 syntax, you can write it like this:

<i className={`${classes.icon} far fa-user`} />
Sign up to request clarification or add additional context in comments.

Comments

2

If you completely understand how React works, you will be putting it this way:

<i className={classes.icon + " far fa-user"} />

The classes.icon will be the className string and along with it, you have to add other classes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.