๐ ๐ผ Styled Components
It's all bout fashun and making your components look good.
Last updated
Was this helpful?
It's all bout fashun and making your components look good.
Last updated
Was this helpful?
Styled components is an external, open source library for, well, creating styled components, or components that have inline, scoped styles.
To use it in a file, just import it to the required file:
Styled components lets us write actual CSS in JS. This means we can use all the features of CSS - media queries, all pseudo selectors, nesting, etc.
Since inside the back-ticks of the styled components is basically a string template, we can manipulate the CSS values inside of it:
We render the StyledPara
like so:
We use the props to render the content conditionally, or ideally add the style properties based on the dynamic content inside the callback function, which is inside CSS styling of the styled-component.
The unusual back ticks ``
here are a new JavaScript feature called .