D
D
DeniSidorenko2021-03-30 13:35:27
React
DeniSidorenko, 2021-03-30 13:35:27

Is it correct to work with CSS on the React project?

Good afternoon, looking through many React lessons, I didn’t really see that styles would be written in separate files, as in layout. I moved from the layout which I have been doing for 2 years, and for example, it’s convenient for me to do the layout, upload the CSS and then cut it on the react. For example, 4 pages of a SPA application and already 1939 lines of styles (without an adaptive yet). I can’t imagine how, for example, to set such an amount of code inline.

To summarize, is it possible that the styles would just be in a separate file and not inline?

Of course, I understand that when we set styles for a component, they are loaded when the component itself is loaded. But as for me, they are too much. More precisely, this can be done when we use the library, but when the design is completely custom, how then to be?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir, 2021-03-30
@DeniSidorenko

If the styles are attached to the component, put them in a separate file, and in the component, do it if you have a common file with styles, you can do it in the app module . I haven’t seen inline styles in combat projects at all, the only thing similar to inline styles is https://styled- components.com/ Personally, I'm all for a sensible mix of styled components and general styles. Or is it something else? By the way, I don’t know what tutorials you watched https://reactjs.org/docs/faq-styling.html#gatsby-f...
import "./styles.css";
import "./main.css";
606302e7d92ce465703010.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question