Put in order · JavaScript and React course · Module 7: Styling and Animations

Basics: Dynamic Styling Process in styled-components

Order the steps for adding dynamic styles in styled-components:

Items to put in order

  • styled-components generates a unique CSS class
  • Pass props to the component: <Button primary />
  • Add ${props => ...} interpolation in the template literal
  • The browser renders the element with dynamic styling
  • Define a styled-component using styled.div

You can check the correct answer by solving this task in the CodeWorlds game.