DEV Community

Discussion on: STYLED COMPONENTS + STYLED SYSTEM = SUPER POWER PART I

Collapse
 
amankumarsingh01 profile image
A

Can you please elaborate about best practice for using styled-components?

Collapse
 
shivashp profile image
Shiva Pandey

Styled components itself is very clear, but just few things you need to consider are:

  • Not every style needs to be customisable some can be hardcoded based on the component
  • Avoid nesting styles as much possible. for e.g don't nest a p tag inside a div within styled component.
  • Styled components works really well if you have a design system. Try to reuse as much possible.