1

In react project using module.css styling I want to make a main folder with variables commonly used for example file variable.js where I will have

export const colors = {
    buttonBackground:"#FFFFFF"
}

I want to pass it to certain classes. Will it work if for example in list.module.css file I will write:

import {colors} from "..."

.complete {
   background-color:${colors.buttonBackground}
}

Or it should be coded in different way ? Sorry I don't have possibility now to test it on my own that's why I write and describe it.

thanks

regards

1 Answer 1

1

in case you need to use some js constants you can have a look at JSS which is a way to write css in js, you can integrate JSS in your react app using this guide

Sign up to request clarification or add additional context in comments.

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.