React JS MCQs 12
111. What is the purpose of the `useEffect` hook in React? a) To manage component state b) To perform side effects after every render (Cor...
111. What is the purpose of the `useEffect` hook in React? a) To manage component state b) To perform side effects after every render (Cor...
101. In React, which lifecycle method is called when a component is about to update? a) componentWillMount b) componentDidUpdate c) com...
What will be the output of the following React component? import React from 'react'; const MyComponent = () => { co...
Which of the following statements correctly imports React in a JSX file? a) import React from 'react'; (Correct Answer) b) re...
What is the purpose of the children prop in a React component? a) It represents the child components rendered inside the component (Corr...
What is the purpose of the useRef hook in React? a) To create references to DOM elements or React components (Correct Answer) b) To m...
In React, which method is called before the component is removed from the DOM? a) componentWillUnmount (Correct Answer) b) componentD...
Which of the following lifecycle methods is called only once, after the initial render? a) componentWillMount b) componentDidMount (C...
What is the purpose of the useRef hook in React? a) To create references to DOM elements or React components (Correct Answer) b) To m...
What is the purpose of the useCallback hook in React? a) To memoize functions so that they are not recreated on every render (Correct An...
What is the purpose of keys in React lists? a) To uniquely identify list items and help React identify which items have changed, added, ...
What is React JS? a) A JavaScript library for building user interfaces (Correct Answer) b) A server-side scripting language c) A r...
Exercise 1: Creating a Simple Component Create a functional React component called Greeting that renders a greeting message. The component should t...
React Basics: What is React? A. A programming language B. A JavaScript library for building user interfaces C. A CSS preprocess...
React Basics: What is React? Answer: React is a JavaScript library for building user interfaces, developed by Facebook. E...
If you're encountering an error in a React application, it can be caused by various reasons. Error messages typically provide information about th...
React Portals provide a way to render children into a DOM node that exists outside the hierarchy of the parent component. This allows you to render ...
React Redux is a state management library for React applications. It is based on the principles of Flux and is designed to help manage the state of a...
Flux is an architectural pattern for building scalable and maintainable web applications. It was created by Facebook to address the challenges of man...
React Bootstrap is a popular library that combines the power of React and the styles and components from the Bootstrap framework. It allows you to qu...