Top 50 React Interview Questions
1. What is the Virtual DOM and how does React use it?
2. Explain the difference between functional and class components.
3. What are React hooks? Name some commonly used ones.
4. How does the useEffect hook work?
5. What is the purpose of useRef and when would you use it?
6. How do you manage state in React?
7. What is the difference between useState and useReducer?
8. What are controlled vs uncontrolled components?
9. How do keys work in React lists?
10. Explain how React’s reconciliation process works.
11. What is JSX and why is it used?
12. What are React fragments and why are they used?
13. How does context API work in React?
14. How is lifting state up helpful?
15. What are higher-order components (HOC)?
16. What are render props?
17. How does memoization work in React?
18. What’s the difference between React.memo and useMemo?
19. What is lazy loading in React?
20. How do you handle error boundaries in React?
21. How do you fetch data in React?
22. Compare React Query vs Redux.
23. What are some alternatives to Redux for global state management?
24. How to implement code splitting in React?
25. What’s the difference between SSR, CSR, and SSG in Next.js?
26. What is hydration in React and how is it handled in Next.js?
27. Explain the useCallback hook with example.
28. When does useEffect run?
29. Why do we need cleanup functions inside useEffect?
30. What are custom hooks? Give an example use case.
31. How do you optimize performance in React applications?
32. How do you handle forms in React?
33. How does React Hook Form work with validation libraries like Yup?
34. How would you build a reusable component library in React?
35. How do portals work in React?
36. What is the role of React DevTools?
37. Explain server-side rendering (SSR) in Next.js.
38. How do dynamic routes work in Next.js?
39. What is ISR (Incremental Static Regeneration) in Next.js?
40. How do you deploy a Next.js app using Vercel?
41. What is the Image component in Next.js used for?
42. How do you handle authentication in React/Next.js apps?
43. How can Firebase be integrated into a React app?
44. What is the difference between useLayoutEffect and useEffect?
45. Explain suspense and error boundaries for async loading.
46. What’s the difference between React context and Redux store?
47. How do you handle deeply nested props in React?
48. How to unit test React components?
49. How to mock API calls for testing React apps?
50. What are the best practices for accessibility in React?