Learn React Js MCQs

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

How do you handle asynchronous operations in React?

1) Using `useEffect` or async functions

2) By using local state

3) By using `refs`

4) By creating global variables

Answer : Option 1

What does `useEffect` hook do?

1) It performs side effects in function components

2) It creates state

3) It defines a component

4) It manages props

Answer : Option 1

How do you prevent a component from re-rendering?

1) Using `React.memo`

2) By using `useEffect`

3) By using `setState`

4) By using props

Answer : Option 1

What is the main purpose of `React Router`?

1) To manage navigation in single-page applications

2) To handle state management

3) To optimize performance

4) To create class components

Answer : Option 1

What is the purpose of the `useReducer` hook?

1) To manage complex state logic

2) To create a component

3) To handle side effects

4) To create refs

Answer : Option 1

What does the `props.children` contain?

1) The nested elements of a component

2) The props passed to the component

3) The component’s state

4) The refs of the component

Answer : Option 1

How do you handle forms in React?

1) By using controlled components

2) By using uncontrolled components

3) By using state

4) By using refs

Answer : Option 1

What does `ReactDOM.render` do?

1) Renders React elements into the DOM

2) Manages state

3) Handles side effects

4) Creates refs

Answer : Option 1

How can you optimize performance in React applications?

1) By using `React.memo`, `useMemo`, and `useCallback`

2) By using class components only

3) By avoiding functional components

4) By using global variables

Answer : Option 1

What does `useRef` do?

1) Creates a mutable object which persists for the full lifetime of the component

2) Manages state

3) Handles side effects

4) Creates a context

Answer : Option 1