React JS MCQs with answers Page - 9

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 • 831.35K Points
Coach

Q. Which React feature helps break the UI into independent pieces?

  • (A) Fragments
  • (B) Components
  • (C) Hooks
  • (D) Keys

A

Admin • 831.35K Points
Coach

Q. What is a React Fragment used for?

  • (A) To return multiple elements without a wrapper
  • (B) To create reusable logic
  • (C) To import multiple files
  • (D) To define state

A

Admin • 831.35K Points
Coach

Q. Which of the following is true about useRef?

  • (A) It causes re-render on change
  • (B) It preserves a mutable reference
  • (C) It creates a new state
  • (D) It is used for performance optimization only

A

Admin • 831.35K Points
Coach

Q. What is the difference between useMemo and useCallback?

  • (A) useMemo memoizes functions, useCallback memoizes values
  • (B) useCallback is used for memoizing values
  • (C) useMemo memoizes values, useCallback memoizes functions
  • (D) They do the same thing

A

Admin • 831.35K Points
Coach

Q. Which one is a correct way to create a functional component?

  • (A) function MyComponent() {}
  • (B) class MyComponent extends Component {}
  • (C) component MyComponent = () => {}
  • (D) def MyComponent() {}

A

Admin • 831.35K Points
Coach

Q. What is the correct syntax to pass a function as a prop?

  • (A) <MyComp func='doSomething' />
  • (B) <MyComp func={doSomething} />
  • (C) <MyComp func={doSomething()} />
  • (D) <MyComp func=doSomething />

A

Admin • 831.35K Points
Coach

Q. Which hook allows you to share logic between components?

  • (A) useShared
  • (B) useGlobal
  • (C) Custom Hooks
  • (D) useEffect

A

Admin • 831.35K Points
Coach

Q. Which attribute is required when using map to render lists?

  • (A) ref
  • (B) name
  • (C) key
  • (D) id

A

Admin • 831.35K Points
Coach

Q. What is the default behavior of React's `useEffect` without a dependency array?

  • (A) It runs only once
  • (B) It runs on every render
  • (C) It runs only on component unmount
  • (D) It never runs

A

Admin • 831.35K Points
Coach

Q. What does `ReactDOM.render()` do?

  • (A) It defines a React component
  • (B) It adds props to components
  • (C) It renders a React element into the DOM
  • (D) It creates a virtual DOM

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