Technical Interview Questions for React Developer

1. What is React?

Answer: React is a JavaScript library used to build fast and interactive user interfaces.

2. What are the main features of React?

Answer: React provides reusable components, virtual DOM, JSX, and efficient state management.

3. What is JSX in React?

Answer: JSX is a syntax extension that allows writing HTML-like code inside JavaScript.

4. What are React components?

Answer: Components are reusable building blocks that define the structure and behavior of a UI.

5. What is the difference between functional and class components?

Answer: Functional components use functions and hooks, while class components use lifecycle methods.

6. What is the Virtual DOM?

Answer: Virtual DOM is a lightweight copy of the real DOM that improves application performance.

7. What are props in React?

Answer: Props are read-only data passed from a parent component to a child component.

8. What is state in React?

Answer: State stores dynamic data that can change during the component lifecycle.

9. What is the difference between props and state?

Answer: Props are passed from parent components, while state is managed inside a component.

10. What are React Hooks?

Answer: Hooks are functions that allow functional components to use state and lifecycle features.

11. What is useState in React?

Answer: useState is a hook used to create and update component state.

12. What is useEffect in React?

Answer: useEffect is a hook used to perform side effects like API calls and subscriptions.

13. What is the use of useMemo in React?

Answer: useMemo optimizes performance by memoizing expensive calculations.

14. What is the use of useCallback in React?

Answer: useCallback prevents unnecessary function recreation during component rendering.

15. What is React Router?

Answer: React Router is a library used for navigation and routing in React applications.

16. What is Redux?

Answer: Redux is a state management library used to manage application-wide data.

17. What is the difference between controlled and uncontrolled components?

Answer: Controlled components use React state, while uncontrolled components use the DOM directly.

18. What is component lifecycle in React?

Answer: Lifecycle describes the stages of component creation, updating, and removal.

19. What are keys in React?

Answer: Keys are unique identifiers used by React to efficiently update lists.

20. What is conditional rendering in React?

Answer: Conditional rendering displays UI elements based on certain conditions.

21. What is React Context API?

Answer: Context API allows sharing data between components without passing props manually.

22. What is lazy loading in React?

Answer: Lazy loading loads components only when they are needed to improve performance.

23. What is code splitting in React?

Answer: Code splitting divides application code into smaller bundles for faster loading.

24. How do you optimize React application performance?

Answer: Performance can be improved using memoization, lazy loading, optimized rendering, and efficient state management.

25. What is the difference between React and Angular?

Answer: React is a UI library focused on components, while Angular is a complete frontend framework.