React JS MCQs with answers Page - 1

Here, you will find a collection of MCQ questions on React JS. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 802.91K Points
Coach

Q. What is the purpose of the useState hook in React?

  • (A) To perform side effects
  • (B) To manage component state
  • (C) To fetch data from API
  • (D) To navigate between pages

A

Admin • 802.91K Points
Coach

Q. Which method is used to render React components to the DOM?

  • (A) React.render()
  • (B) ReactDOM.render()
  • (C) renderComponent()
  • (D) Component.render()

A

Admin • 802.91K Points
Coach

Q. In React, what is JSX?

  • (A) A templating engine
  • (B) A type of CSS
  • (C) JavaScript XML syntax for defining UI
  • (D) A server-side scripting language

A

Admin • 802.91K Points
Coach

Q. Which hook is used to perform side effects in functional components?

  • (A) useState
  • (B) useEffect
  • (C) useReducer
  • (D) useRef

A

Admin • 802.91K Points
Coach

Q. What is the virtual DOM in React?

  • (A) A real DOM in memory
  • (B) A UI rendered in JavaScript
  • (C) A lightweight in-memory representation of the real DOM
  • (D) A CSS engine

A

Admin • 802.91K Points
Coach

Q. What is the default state of a new useState variable?

Code:
const [count, setCount] = useState();
  • (A) 0
  • (B) undefined
  • (C) null
  • (D) 1

A

Admin • 802.91K Points
Coach

Q. Which method is used to pass data from parent to child in React?

  • (A) props
  • (B) state
  • (C) context
  • (D) dispatch

A

Admin • 802.91K Points
Coach

Q. How do you prevent a component from re-rendering in React?

  • (A) By returning null in render
  • (B) By using React.memo
  • (C) By avoiding JSX
  • (D) By not using useState

A

Admin • 802.91K Points
Coach

Q. What does the key prop do in React lists?

  • (A) It sets the list style
  • (B) It uniquely identifies elements for efficient updates
  • (C) It adds a password to components
  • (D) It defines accessibility

A

Admin • 802.91K Points
Coach

Q. Which hook allows sharing logic between components in React?

  • (A) useCallback
  • (B) useState
  • (C) Custom hooks
  • (D) useEffect

Add MCQ in this Category

If you want to share an MCQ question in this category, it's a great idea! It will be helpful for many other students using this website.

Share Your MCQ