Next.js · Senior · Question 56 of 75
How can a 'use cache' component accept children if JSX can't be serialized as a cache key?
- ✓Correct answer: React elements are allowed as pass-through: the component can place them in its output but must not inspect them
- 2
childrenare converted to an HTML string and hashed - 3It can't - cached components must not take
children
Explanation
Pass-through values don't affect the cached result, so the cached shell can wrap dynamic content. The same applies to functions passed through to client components.