Design Patterns · Senior · Question 3 of 75

Why is React declared as a shared singleton in Module Federation?

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.

Further reading

Problem with a question

Design Patterns · Senior · question 3

Test yourself

Take the Design Patterns · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz