Daniel
Daniel

Reputation: 516

Changing Stylesheets in React

I'm working on a React app. I have a few different stylesheets to restyle the same elements. Let's say for sake of this question I have two that have identical elements but different styles. Right now, in the app, I just import it with:

import './Stylesheet1.css';

What I'd like to do is, based on a setting for that customer in a database, it would switch to using ./Stylesheet2.css instead.

I know there are extra modules to include out there that may help and I could do things with dynamically building stylesheets and I may need to go to those options, but for now, I'd like to see if there is simply some way to dynamically swap out which CSS file I'm pointed to.

Upvotes: 0

Views: 1167

Answers (1)

Guillermo Quiros
Guillermo Quiros

Reputation: 441

Well another way you can do this is as follow:

import style1 from './Stylesheet1.css'; import style2 from './Stylesheet1.css';

Upvotes: 1

Related Questions