Skip to content

FlashcardNot attempted

SOLID in one line each (frontend edition)

Recall it before you reveal

State all five SOLID principles with a React example each.

Space to reveal
Show answer & explanation
  • Single responsibility: one reason to change → custom hooks for logic, small presentational components
  • Open/closed: extend without editing → variants, composition, render props
  • Liskov substitution: substitutes must honour the contract → a <LinkButton> must behave like a <Button>
  • Interface segregation: no unused dependencies → pass the fields a component needs, not whole objects
  • Dependency inversion: depend on abstractions → inject the api client or services via props/context