Learn React Js MCQs

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

How do you handle complex state logic?

1) Using `useState`

2) Using `useEffect`

3) Using `useReducer`

4) Using `useRef`

Answer : Option 3

What is the purpose of `useMemo`?

1) To manage state

2) To optimize rendering by memoizing a value

3) To handle side effects

4) To create refs

Answer : Option 2

What is the purpose of the `React.useState` hook?

1) To manage the component’s local state

2) To handle side effects

3) To optimize performance

4) To create refs

Answer : Option 1

How can you make a component re-render in React?

1) By changing its state or props

2) By using `useEffect`

3) By using `useMemo`

4) By using `useReducer`

Answer : Option 1

What does `React.Component` do?

1) It defines a class component

2) It defines a functional component

3) It creates a new context

4) It handles side effects

Answer : Option 1

What is a React hook?

1) A function that lets you use state and other React features

2) A way to create class components

3) A method to handle side effects

4) A way to optimize performance

Answer : Option 1

What is the correct way to pass props to a component?

1) Props can be passed using attributes

2) Props can be passed using state

3) Props can only be passed using context

4) Props can only be passed using refs

Answer : Option 1

How can you access a child component’s method?

1) Using `refs`

2) Using props

3) Using state

4) Using context

Answer : Option 1

What is the purpose of the `key` prop in React?

1) To uniquely identify elements in a list

2) To manage state

3) To handle side effects

4) To create refs

Answer : Option 1

How do you handle form submission in React?

1) Using `onSubmit` event

2) Using `onChange` event

3) Using `onClick` event

4) Using `onKeyPress` event

Answer : Option 1