We need a simple React component that shows the 10th Fibonacci number. How would you write the function using memoization so it only computes each value once?
If you forget to include a dependency array in useMemo for the Fibonacci calculation, what will happen when the component re‑renders?
Your team added an input where users can type N and see the Nth Fibonacci number. The UI becomes sluggish for large N. Walk me through how you would refactor the code using memoization to fix the performance issue.
After introducing memoization, the component still sometimes shows stale results when the input changes quickly. Why might that happen and how would you debug it?
Design a reusable custom hook called useFibonacci that memoizes results across the whole app. Explain how you would manage the cache, handle cache invalidation, and avoid memory leaks.
The app now needs to support N values up to 10,000 without blocking the UI. How would you adapt your memoized Fibonacci solution to handle such large inputs efficiently?
Multiple front‑ends (React web, React Native) need to compute Fibonacci numbers. Would you keep memoization client‑side, move it to a shared service, or use a hybrid approach? Discuss the trade‑offs in latency, cache consistency, and maintenance.
Our legacy codebase has a hand‑rolled memoization pattern scattered across components. How would you plan a migration to a centralized, type‑safe solution while minimizing risk to production?