Learn React Js MCQs
Prepare React Js MCQs (Multiple choice Questions) for exam and job interviews.
What is the purpose of useImperativeHandle hook?
1) To customize the instance value that is exposed when using ref
2) To manage state
3) To perform side effects
4) To handle events
Answer : Option 1
How do you handle routing in a React application?
1) Using React Router library
2) Using history API
3) Using window.location
4) Using fetch API
Answer : Option 1
What is the purpose of React.StrictMode?
1) To enable additional checks and warnings in development mode
2) To improve performance
3) To handle asynchronous operations
4) To manage component state
Answer : Option 1
How do you define a state variable in a React functional component?
1) Using useState hook
2) Using this.state
3) Using this.setState
4) Using useEffect hook
Answer : Option 1
What does React.createElement method do?
1) Creates a React element
2) Creates a class component
3) Creates a functional component
4) Creates a context
Answer : Option 1
How do you manage side effects in a React component?
1) Using useEffect hook
2) Using useState hook
3) Using useCallback hook
4) Using useMemo hook
Answer : Option 1
What is the purpose of React.Fragment?
1) To group multiple elements without adding extra nodes to the DOM
2) To handle routing
3) To manage state
4) To perform side effects
Answer : Option 1
How do you handle dynamic imports in React?
1) Using React.lazy and Suspense
2) Using import statement
3) Using require statement
4) Using fetch API
Answer : Option 1
What does React.memo do?
1) Memoizes functional components to prevent unnecessary re-renders
2) Creates a context
3) Manages state
4) Handles side effects
Answer : Option 1
How do you use the useReducer hook?
1) To manage complex state logic
2) To handle side effects
3) To manage component lifecycle
4) To create refs
Answer : Option 1