Design Patterns · Middle · Question 38 of 75
What is the Registry pattern, using plugins as an example?
const renderers = new Map();
export const register = (type, fn) => renderers.set(type, fn);
export const render = (block) => renderers.get(block.type)?.(block);- ✓Correct answer: Handlers register by key, and the core doesn't know about them
- 2All of the app's data is written to the Windows registry
- 3Components register in the DOM as Custom Elements
Explanation
This is how extensible systems are built: CMS editor blocks, dashboard widgets, validation rules. A new type is added by registration, without changing the core (OCP).