Design Patterns · Senior · Question 3 of 75
Why is React declared as a shared singleton in Module Federation?
- ✓Correct answer: Two copies of React in one app break hooks and context
- 2Otherwise React loads more slowly due to missing CDN cache
- 3It's a React license requirement for commercial projects
Explanation
Hooks and context are tied to a specific React instance: a component from a remote module with its own copy causes "Invalid hook call", and contexts aren't visible. Shared singleton dependencies require coordinating versions between teams.