React · Middle · Question 66 of 75
What is the <Profiler> component for?
<Profiler id="Sidebar" onRender={(id, phase, actualDuration) => log(id, actualDuration)}>
<Sidebar />
</Profiler>- ✓Correct answer: Measuring how often a subtree renders and how long it takes, programmatically
- 2Showing a loading indicator
- 3Logging errors from the subtree
Explanation
It adds some overhead and is disabled in production builds by default. The DevTools Profiler is usually enough for manual investigation.