QuizNot attempted
Open/Closed in React
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Accept a
variantfrom a config map, or composition (icon,children,className) so new behaviour plugs in from outside
- Open/Closed means open for extension, closed for modification: a variant config map or composition (
icon,children,className) lets new styles plug in without touching tested internals. - Not another if branch: that is modification every time.
- Not copy-paste PurpleButton: duplicates logic that will drift.
- Not global !important: bypasses the component and breaks the cascade for everyone.