M
M
mishapsv2015-08-27 12:54:44
React
mishapsv, 2015-08-27 12:54:44

How to correctly include styles in React?

There is a ready-made layout, for styles - SASS. And as usual: the general style file is included in the header.
Now the task is to rewrite everything with React components.
And here's the question: how to properly organize their connection? Leave as is or inline?
What do you recommend (method, tools)? What can be pitfalls?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ennam, 2015-08-27
@ennam

Have a look at the solution used for example here:
https://github.com/anorudes/redux-easy-boilerplate
Allows you to import sass and encapsulate it.
Take a look at /src/components/Items
for a better understanding
. You can write any nesting in the sass file itself.
That is, you can write:

:local(.styles) {
  .title {
  }
}

Next, just import into js and insert the generated encapsulated class name through className

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question