Design Patterns · Senior · Question 26 of 75
What's the right way to evolve the public API of a shared component library?
- ✓Correct answer: SemVer, a deprecation period and codemods
- 2Change the API anytime - consumers will update themselves
- 3Never change the API after the first release
Explanation
A breaking change is a major version; before removing an API, mark it deprecated with a warning and instructions. Codemods (like those for Next.js and React) automate migration. This way the library evolves without breaking dozens of apps.