React Mid
What is React.memo, and how can it be used to optimize functional components?
Select the correct answer
React.memo is a method for managing component state.
React.memo is used to fetch data from an API.
React.memo is a higher order component used to optimize functional components by preventing unnecessary re-renders.
React.memo is used to define component styles.
What is a Higher-Order Component (HOC) in React?
Select the correct answer
A Higher-Order Component (HOC) in React is a method for fetching data.
A Higher-Order Component (HOC) in React is a technique for styling components.
A Higher-Order Component (HOC) in React is a way to manage component state.
A Higher-Order Component (HOC) in React is a function that takes a component and returns a new component.
What is a React error boundary, and how can it be useful for handling errors in components?
Select the correct answer
A React error boundary is a component that catches JavaScript errors anywhere in their child component tree.
A React error boundary is a way to define component styles.
A React error boundary is a method for managing component state.
A React error boundary is used to fetch data from an API.
Why is it important to maintain immutability when updating state in React?
Select the correct answer
Maintaining immutability when updating state in React is important because it helps ensure predictable state changes and simplifies debugging.
Maintaining immutability when updating state in React is important because it allows direct manipulation of DOM elements.
Maintaining immutability when updating state in React is important because it enhances CSS performance.
Maintaining immutability when updating state in React is important because it simplifies HTML markup.
Why can hooks not be conditional in React?
Select the correct answer
Hooks cannot be conditional in React because they cannot access props.
Hooks cannot be conditional in React because they cannot be used inside loops.
Hooks cannot be conditional in React because they rely on a consistent order of execution.
Hooks cannot be conditional in React because they cannot handle asynchronous code.
What is the difference between controlled vs. uncontrolled components in React?
Select the correct answer
Controlled components in React have their state controlled by React, while uncontrolled components have their state controlled by the DOM.
Controlled components in React can only be used in class components.
Uncontrolled components in React are used for managing global state.
Controlled components in React are used for handling side effects.
What is a pure function in React?
Select the correct answer
A pure function in React is a function that returns the same output for the same input without side effects.
A pure function in React is a function that can mutate state directly.
A pure function in React is a function that fetches data.
A pure function in React is a function that makes API calls.
What are forward refs?
Select the correct answer
Forward refs in React are used to manage component state.
Forward refs in React are used to fetch data from an API.
Forward refs in React are used to pass refs to child components.
Forward refs in React are used to handle side effects.
What are the two primary ways of creating components in React?
Select the correct answer
The two primary ways of creating components in React are CSS components and HTML components.
The two primary ways of creating components in React are server components and client components.
The two primary ways of creating components in React are functional components and class components.
The two primary ways of creating components in React are state components and stateless components.
What are the purpose of keys in React lists?
Select the correct answer
Keys in React lists help identify which items have changed, are added, or removed.
Keys in React lists are used to style the list items.
Keys in React lists are used to fetch data for the list items.
Keys in React lists are used to create event handlers for the list items.
Can web browsers read JSX directly?
Select the correct answer
No, web browsers cannot read JSX directly; it needs to be transpiled to JavaScript.
Yes, web browsers can read JSX directly without any transpilation.
Only some web browsers can read JSX directly.
Web browsers can read JSX if it is included in a script tag.
What does reconciliation mean in React?
Select the correct answer
Reconciliation in React is the process of updating the DOM to match the virtual DOM.
Reconciliation in React is the process of managing component states.
Reconciliation in React is the process of fetching data from APIs.
Reconciliation in React is the process of defining component styles.
What are React Fragments?
Select the correct answer
React Fragments are a method for managing state in React.
React Fragments are used to define CSS styles in React.
React Fragments are a way to handle side effects in React.
React Fragments let you group multiple elements without adding extra nodes to the DOM.
What is the virtual DOM?
Select the correct answer
The virtual DOM is a database for storing component states.
The virtual DOM is a tool for managing API requests.
The virtual DOM is a lightweight copy of the actual DOM that React uses to optimize updates.
The virtual DOM is a CSS framework for styling components.
What is NextJS and major features of it?
Select the correct answer
NextJS is a React framework for server-side rendering and static site generation.
NextJS is a CSS framework for styling React applications.
NextJS is a database management system for React applications.
NextJS is a testing library for React applications.
What are lifecycle methods?
Select the correct answer
Lifecycle methods are special methods in React components that are called at different stages of a component's life.
Lifecycle methods are used to style React components.
Lifecycle methods are used to fetch data in React components.
Lifecycle methods are used to define routes in React components.
What does unmounted mean in React?
Select the correct answer
Unmounted in React means the component is initialized but not rendered.
Unmounted in React means the component has been removed from the DOM.
Unmounted in React means the component is ready to receive props.
Unmounted in React means the component has been rendered to the DOM.
What does mounted mean in React?
Select the correct answer
Mounted in React means the component is initialized but not rendered.
Mounted in React means the component has been removed from the DOM.
Mounted in React means the component has been rendered to the DOM.
Mounted in React means the component is ready to receive props.
What does lifting state up mean in React?
Select the correct answer
Lifting state up means moving state to the global scope.
Lifting state up means moving state to a child component.
Lifting state up means moving state to a common ancestor component.
Lifting state up means moving state to a sibling component.
Name tools that can be used to test React apps?
Select the correct answer
Tools like Webpack and Babel can be used to test React apps.
Tools like MongoDB and PostgreSQL can be used to test React apps.
Tools like Redux and MobX can be used to test React apps.
Tools like Jest, Enzyme, and React Testing Library can be used to test React apps.
What are synthetic events in React?
Select the correct answer
Synthetic events in React are cross-browser wrappers around native events.
Synthetic events in React are a way to manage component state.
Synthetic events in React are a method for fetching data.
Synthetic events in React are a way to define CSS styles.
How do you create an event in React?
Select the correct answer
You create an event in React by defining CSS styles.
You create an event in React by writing HTML templates.
You create an event in React by using the useState hook.
You create an event in React by defining an event handler function and attaching it to an element.
What is an event in React?
Select the correct answer
An event in React is an object that represents a user action.
An event in React is a component lifecycle method.
An event in React is a method for managing state.
An event in React is a way to define component styles.
How to loop inside JSX?
Select the correct answer
You can loop inside JSX using the useState hook.
You can loop inside JSX using CSS styles.
You can loop inside JSX using HTML templates.
You can loop inside JSX using the map() function.