To optimize large lists in React, you can use a technique called ______ rendering.

  • Eager
  • Incremental
  • Lazy
  • Virtual
To optimize large lists in React, you can use a technique called "Incremental" rendering. This approach renders only the visible items in a list, improving performance when dealing with extensive lists. It's a key strategy to enhance user experience in React applications, especially when handling large datasets.

You've noticed that every time a parent component's state changes, a child component re-renders even though its props remain unchanged. How might you optimize the child component to prevent unnecessary re-renders?

  • Use React.memo
  • Use componentDidUpdate
  • Use shouldComponentUpdate
  • Use useEffect
You can optimize the child component by using React.memo. This higher-order component (HOC) can wrap your child component, preventing it from re-rendering when its props remain unchanged. componentDidUpdate and useEffect are used for side effects and don't address the issue of unnecessary re-renders. While shouldComponentUpdate can be used in class components, React.memo is the recommended way in functional components.

One popular method for ensuring state immutability in Redux is using the ________ utility functions.

  • Immutable.js
  • Lodash
  • Reselect
  • Spread Operator
The spread operator (often denoted as "..." in JavaScript) is a popular method for ensuring state immutability in Redux. It allows you to create shallow copies of objects or arrays, ensuring that changes to the state do not mutate the original state, which is crucial for maintaining the integrity of the Redux store.

In React, event handlers set on components are actually set on the ________ and not on the individual elements.

  • component instances
  • document root
  • individual elements
  • parent container
In React, event handlers set on components are actually set on the component instances themselves and not on the individual DOM elements. This allows React to efficiently manage and delegate events within its virtual DOM, making it a key aspect of React's event handling mechanism.

You are building a form in a functional component and need to keep track of form input values. Which hook would be most appropriate to manage the form state?

  • useContext
  • useEffect
  • useMemo
  • useState
To manage form input values in a functional component, the most appropriate hook is useState. useState allows you to create and update state variables, which can be used to track form input values as users interact with the form elements. While useEffect, useMemo, and useContext have their use cases, they are not designed for managing form state directly.

React Native's mechanism to "hot reload" and see changes instantly without a full app reload is called ________.

  • Instant Refresh
  • Quick Reload
  • Rapid Refresh
  • Swift Update
React Native's mechanism to "hot reload" and see changes instantly without a full app reload is called "Instant Refresh." It is a valuable feature in React Native development that accelerates the development process by allowing developers to view changes immediately. The other options do not accurately describe this specific React Native feature.

You are designing a quiz application where users can click on an option to choose their answer. To highlight the selected option and store the user's choice, you would use ________ to manage this local UI state.

  • useState
  • useRef
  • useReducer
  • useContext
To manage the local UI state in a quiz application where users can select answers, you would use the useState hook. useState allows you to create state variables that can hold the selected option and trigger UI updates when the user makes a choice. While useRef, useReducer, and useContext have their use cases, they are not the primary choice for managing local UI state in this scenario.

Data sent between the main thread and a Web Worker is done through a process called ________.

  • WebComm
  • DataLink
  • MessagePassing
  • WebBridge
Data is sent between the main thread and a Web Worker through a process called "Message Passing." In Web Workers, messages can be passed between the main thread and the worker thread to exchange data and instructions. This communication method is essential for the interaction between the two threads. The other options are not the standard terms used for this process.

How can you ensure that a modal dialog rendered through a Portal remains accessible for screen reader users?

  • Implement ARIA roles and attributes correctly.
  • Rely on the default behavior of screen readers.
  • Use CSS to hide the modal from screen readers.
  • Use JavaScript to disable screen reader functionality.
To ensure accessibility for screen reader users, it's crucial to implement ARIA (Accessible Rich Internet Applications) roles and attributes correctly. ARIA provides semantic information to assistive technologies like screen readers, making the modal content understandable and navigable. Hiding the modal with CSS or disabling screen reader functionality is not recommended as it can hinder accessibility. Relying on default behavior may not guarantee accessibility.

Which React-Redux hook can be used to dispatch an action to the Redux store?

  • useDispatch
  • useStore
  • useState
  • useSelector
The useDispatch hook is used to dispatch actions to the Redux store in a React-Redux application. It provides a reference to the dispatch function, allowing you to trigger actions from your components. The other options are not used for dispatching actions.