How to style react web pages (beginner)
Hi guys, im trying to create my first React website but im unsure about the best practice for styling.
For example, lets say I create a HomePage component, which is basically an empty component that has a separate NavBar, Body and Footer component. My question is, how would I arrange each of these elements within the HomePage component? Like, if I wanted the Body component to be three quarers of the way down on the HomePage component, do I use the Body as a selector in css or something within the HomePage style sheet?
Im finding all this really confising in React, so any help is really appreciated
1 Reply
Sadly React has many confusing parts.
At work we have the same structure, that is under
/components
also under /theme
in the first are the .tsx
files, in the second the .scss
files with the same name. Those get imported by one base SCSS-file, which is imported in the index.tsx
.
You could also import the .scss
in each component and/or put it in the same folder as the .tsx
.
For selecting elements we use classes.