OOCSS primarily focuses on separating container and content, and promoting the reuse of ________.

  • CSS rules
  • HTML elements
  • JavaScript functions
  • Styles
Object-Oriented CSS (OOCSS) emphasizes separating the container and content in your styles and promoting the reuse of styles (i.e., CSS rules). This approach helps keep your CSS modular, making it easier to maintain and reducing redundancy in your code.

When using Styled Components, how would you dynamically change the style of a component based on its props?

  • Create separate component variants for each style and switch between them using conditional rendering.
  • Styled Components do not support dynamic style changes based on props.
  • Use the class prop to assign different CSS classes based on prop values.
  • Use the style prop to pass in an inline CSS object and conditionally apply styles based on prop values.
In Styled Components, you can dynamically change the style of a component based on its props by using the style prop. You can pass in an inline CSS object and conditionally apply styles based on the values of the props. This allows for the creation of versatile and reusable components.