The React Compiler (formerly React Forget) automatically memoises components and values at build time, eliminating manual useMemo and useCallback calls. These exercises test your understanding of its core concepts and terminology.
0 / 5 completed
1 / 5
What is the primary goal of the React Compiler (formerly React Forget)?
React Compiler analyses component code at build time and inserts memoisation automatically, eliminating the need for manual useMemo, useCallback, and React.memo. It targets the performance benefits of memoisation without the ergonomic cost of writing it by hand.
2 / 5
What are the Rules of React that the React Compiler relies on?
Rules of React are the contracts the compiler depends on to safely insert memoisation. If a component is not pure — for example it reads a mutable global or produces different output for the same props — the compiler cannot guarantee correctness and will skip optimising that component.
3 / 5
What does the use no memo directive do in a React component?
use no memo is a string directive placed at the top of a component or hook function body. It tells the React Compiler to skip that specific function during compilation, which is useful when the compiler incorrectly transforms code that violates the Rules of React in ways it cannot detect statically.
4 / 5
Which tool can you use to verify that a component is compatible with the React Compiler before enabling it?
react-compiler-healthcheck is the official CLI tool that scans a codebase and reports which components follow the Rules of React and are safe for compilation. It helps teams assess readiness before enabling the compiler across an entire project.
5 / 5
How does the React Compiler handle automatic memoisation of a value that depends on props?
Automatic memoisation by the React Compiler is granular: it performs static data-flow analysis to understand which values depend on which inputs. Cache invalidation logic is inserted only around values that could change, avoiding unnecessary wrapping that would add overhead rather than reduce it.