Learn React Js MCQs

Prepare React Js MCQs (Multiple choice Questions) for exam and job interviews.

What is the purpose of React.forwardRef?

1) To forward refs to child components

2) To handle state

3) To create higher-order components

4) To manage side effects

Answer : Option 1

How do you handle context in React?

1) Using useContext hook

2) Using this.context

3) Using context API directly

4) Using React.createContext

Answer : Option 1

What does React.lazy do?

1) Enables lazy loading of components

2) Creates a class component

3) Handles routing

4) Manages state

Answer : Option 1

How do you use useCallback hook?

1) To memoize callback functions and prevent unnecessary re-renders

2) To manage state

3) To handle side effects

4) To create refs

Answer : Option 1

What is the role of React.createElement?

1) To create a React element from JSX

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 statements directly

3) Using require statements

4) Using fetch API

Answer : Option 1

What is React.PureComponent used for?

1) To create components with shallow comparison of props and state

2) To manage state

3) To handle events

4) To perform side effects

Answer : Option 1

How do you manage side effects in React?

1) Using useEffect hook

2) Using useState hook

3) Using useCallback hook

4) Using useMemo hook

Answer : Option 1

What is the purpose of useReducer?

1) To manage complex state logic

2) To handle side effects

3) To manage component lifecycle

4) To create refs

Answer : Option 1

How do you access props in functional components?

1) Using props argument

2) Using this.props

3) Using context API

4) Using useState hook

Answer : Option 1