是从https://www.geeksforgeeks.org/reactjs/react-interview-questions/获取的。

Basic Level

Basic React Interview Questions

1. How does React.js work?

💡 核心回答:React 是如何工作的?

React 的核心工作原理可以概括为:“声明式 UI” + “虚拟 DOM” + “组件化”

第一步:声明式 UI (Declarative UI)

你只需要告诉 React “页面现在应该长什么样”(通过 State 状态),而不需要手动去操作浏览器 DOM(比如 appendChildremoveChild)。

通俗点说:你只负责换“剧本”(状态),React 负责“演戏”(更新界面)。

第二步:虚拟 DOM 与 Diff 算法 (Virtual DOM & Diffing)

  1. 生成快照:每当状态(State)改变时,React 会在内存中生成一棵新的虚拟 DOM 树(一个轻量级的 JS 对象)。
  2. 找茬 (Diffing):React 会把这棵“新树”和“旧树”进行对比,算出哪些地方变了。
  3. 精准更新:React 只会将变化的部分更新到真实的浏览器 DOM 上,而不是重新渲染整个页面。

第三步:组件化 (Component-Based)

React 把界面拆分成一个个独立的、可复用的组件。每个组件有自己的逻辑和状态,最后像搭积木一样拼成复杂的应用。

 

答案:

1. 核心回答 (Core Answer) 可以只背诵这一个,下面两个先了解

English: React works based on a Declarative approach and a Component-based architecture. The core mechanism involves the Virtual DOM, the Diffing algorithm, and the Fiber Reconciler.

中文翻译: React 基于声明式设计和组件化架构工作。其核心机制包括虚拟 DOMDiff 算法Fiber 协调器


2. 渲染流程三部曲 (Three-Step Process)

English:

  1. Trigger: A state change or a prop update triggers a re-render.
  2. Render Phase: React executes the component functions and generates the Fiber tree. This phase is asynchronous and can be paused or interrupted (Concurrent feature).
  3. Commit Phase: React applies the calculated changes to the real DOM in a single synchronous step to ensure UI consistency.

中文翻译:

  1. 触发: 状态改变或 Props 更新触发重新渲染。
  2. 渲染阶段 (Render Phase): React 执行组件函数并生成 Fiber 树。这个阶段是异步的,可以被暂停或中断(这是并发特性)。
  3. 提交阶段 (Commit Phase): React 将计算出的变更一次性同步应用到真实 DOM 上,以确保 UI 的一致性。

3. 针对 Next.js 的进阶补充 (Advanced Bonus for Next.js)

English: In the latest Next.js (App Router), React also supports Server Components. Some components are pre-rendered on the server to reduce the client-side JavaScript bundle, while Hydration connects the client-side interactivity to the server-rendered HTML.

中文翻译: 在最新的 Next.js (App Router) 中,React 还支持服务端组件 (RSC)。部分组件直接在服务端预渲染以减少客户端的 JS 包体积,而水合 (Hydration) 过程则负责将客户端交互绑定到服务端生成的 HTML 上。

2. What is JSX and how is it converted into JavaScript?

English Answer (Optimized): JSX (JavaScript XML) is a syntax extension for JavaScript that allows you to write HTML-like structures within your JS code. It makes UI code more readable and expressive.

中文翻译: JSX (JavaScript XML) 是 JavaScript 的语法扩展,允许你在 JS 代码中编写类似 HTML 的结构。它使 UI 代码更具可读性和表现力。

3. What is a React component?

已经有答案了。

4. Difference between functional and class component in React?

已经有答案了。

5. What are props and default props in React?

6. What is state in React and how do you update it?

已经有答案了。

7. Difference Between Props and State in React?

已经有答案了。

8. What are fragments in React?

English Answer: Fragments allow you to group multiple elements without adding extra nodes to the DOM.

中文翻译: Fragment(片段)允许你将多个元素组合在一起,而无需向 DOM 中添加额外的节点。

9. What is the difference between controlled and uncontrolled components?

English Answer (Optimized):

中文翻译:

10. How does the DOM manage the input value in uncontrolled components?

React does not manage the form input’s state. Instead, the DOM itself keeps track of the input’s value. You can access the value when needed using refs

React Hooks Interview Questions

11. What are Hooks in React and why were they introduced?

English Answer (Optimized): Hooks are special built-in functions that allow functional components to use state, lifecycle methods, and other React features. They were introduced to solve several issues:

中文翻译: Hooks 是特殊的内置函数,允许函数组件使用状态、生命周期方法和其他 React 特性。 引入 Hooks 是为了解决以下问题:

12. How does the useState hook work?

The useState hook allows you to add state to functional components. It returns a state variable and a setter function to update that state. When the state changes, React re-renders the component with the updated value.

Example:

In this example:

13. What is useEffect in React and what is the role of its dependency array?

English Answer (Optimized): useEffect handles "side effects" like data fetching, subscriptions, or manual DOM updates. The dependency array controls when the effect re-runs:

中文翻译: useEffect 用于处理“副作用”,如数据获取、订阅或手动操作 DOM。 依赖项数组决定了 Effect 何时重新执行:

Example :

14. What is the difference between useEffect and useLayoutEffect?

English Answer (Optimized):

中文翻译:

15. What is the useContext hook and when should you use it?

The useContext hook allows functional components to consume values from a React Context without passing props through every level of the component tree (avoiding “prop drilling”).

When to use it:

16. What is the useReducer hook and when is it preferred over useState?

English Answer (Optimized): useReducer is a hook for managing complex state logic, working similarly to Redux. It takes a reducer function and an initialState, returning the current state and a dispatch function. Use it when:

中文翻译: useReducer 是用于管理复杂状态逻辑的 Hook,工作原理类似于 Redux。 它接收一个 reducer 函数和 initialState(初始状态),返回当前状态和 dispatch 函数。 适用场景:

17. What is the useRef hook and what are its common use cases?

The useRef hook creates a mutable object that persists across renders without causing re-renders. It is commonly used to access DOM elements or store mutable values.

Example:

In this example:

Common use cases:

18. Explain the difference between useMemo and useCallback?

English Answer (Optimized): Both are used for performance optimization through memoization:

中文翻译: 两者都通过记忆化(Memoization)用于性能优化:

19. What are custom hooks in React and how do you create one?

Custom hooks are reusable functions that let you extract and share logic between functional components. They are JavaScript functions whose names start with use and can call other hooks like useState or useEffect.

Example:

In this example, useFetch is a custom hook that fetches data from an API and manages loading state. The hook is reused in App to keep the component clean and separate the data-fetching logic.

20. What are the rules of hooks and why are they important?

React State Management Interview Questions

21. What is State Management in React and what is the difference between Local and Global State?

English Answer (Optimized):

中文翻译:

22. What are some popular state management solutions in React/Next.js?

There are several approaches and libraries for managing state in React and Next.js, depending on the scale and complexity of your application:

23. When should you use Redux over Context API?

24. What is the difference between Client State and Server State?

English Answer:

中文翻译:

25. Explain the Context API in React.

The Context API in React is used to share data globally across components without prop drilling. It allows you to wrap components with a provider and access the shared value anywhere in the tree using useContext.createContext() : Creates a context.

26. What is the role of useReducer in state management?

The useReducer hook in React plays an important role in state management when the logic for updating state is complex or involves multiple actions. Unlike useState, which is best for simple state updates, useReducer organizes state transitions using a reducer function, making the code more predictable and easier to maintain. It is especially useful in larger applications or when managing related pieces of state.

27. How do you handle persistent state in React apps?

English Answer (Optimized): To ensure data survives a page reload, we use:

中文翻译: 为了确保数据在页面刷新后不丢失,我们使用:

28. What is the difference between derived state and computed state in React?

In React, sometimes you need values that depend on other state or props. These values can be handled as derived state or computed state, but they work differently:

29. How can you optimize state updates for performance in React?

Optimizing state updates ensures that components re-render only when necessary, improving performance in React applications:

30. How do you handle asynchronous state updates in React?

English Answer (Optimized): Since React state updates are asynchronous and batched for performance:

中文翻译: 由于 React 的状态更新是异步的且为了性能会进行批处理:

 

React Rendering & Performance Questions:

31. Can you explain what the Virtual DOM is and how React uses it?

English Answer (Optimized):

中文翻译:

How does the Diffing Algorithm work?

English Answer (Optimized): React’s Diffing algorithm is based on two main assumptions to keep the complexity at O(n):

  1. Different Types: If two elements have different types (e.g., changing a <div> to a <span>), React will tear down the old tree and build a new one.
  2. Keys: For lists of elements, React uses the key prop to identify which items have changed, been added, or been removed. This allows React to reorder elements instead of re-rendering the entire list.

中文翻译: React 的 Diff 算法基于两个主要假设,从而将复杂度控制在 O(n)

  1. 不同类型:如果两个元素的类型不同(例如从 <div> 变成 <span>),React 会销毁旧树并构建全量新树。
  2. Key 属性:对于元素列表,React 使用 key 属性来识别哪些项发生了变化、被添加或被移除。这允许 React 仅进行移动操作,而不是重新渲染整个列表。

32. What do you understand by reconciliation in React? Why is it important?

English Answer (Optimized): Reconciliation is the process through which React updates the DOM. It involves:

  1. Generating a new Virtual DOM tree when state or props change.
  2. Comparing the new tree with the previous one (Diffing).
  3. Computing the most efficient way to update the Real DOM to match the new state. This process is now handled by the Fiber engine in modern React, which allows the work to be split into chunks.

中文翻译: 协调(Reconciliation)是 React 更新 DOM 的过程。它包括:

  1. 当状态或属性变化时生成新的虚拟 DOM 树。
  2. 将新树与旧树进行对比(Diffing)。
  3. 计算出更新真实 DOM 以匹配新状态的最优方案。在现代 React 中,这个过程由 Fiber 引擎处理,它允许将更新任务拆分为多个小块异步完成。

33. How does React.memo help improve performance?

English Answer: React.memo is a Higher-Order Component used for performance optimization. It performs a shallow comparison of a component's props. If the props haven't changed between renders, React skips rendering that component and reuses the last rendered result. It is most effective for components that render often with the same props.

中文翻译: React.memo 是一个用于性能优化的高阶组件。它对组件的 Props 进行浅比较。如果两次渲染之间 Props 没有变化,React 就会跳过该组件的渲染并复用上次的结果。它对于那些经常带着相同 Props 频繁渲染的组件最为有效。

34. If I ask you to optimize a slow React application, what techniques would you use?

To improve performance in a slow React application, you can use several optimization techniques:

35. What do you mean by code splitting and lazy loading in React?

Code splitting and lazy loading are techniques used to improve performance by reducing the initial load time of a React application.

In React, this is often implemented with React.lazy and <Suspense>:

36. How would you optimize a slow React application?

English Answer (Optimized):

  1. Skip unnecessary re-renders: Use React.memo for components, and useCallback/useMemo for stabilizing references and values.
  2. Code Splitting: Use React.lazy and Suspense to load components only when needed, reducing initial bundle size.
  3. List Optimization: Always use stable and unique key props. For very long lists, use "Windowing" or "Virtualization" (e.g., react-window).
  4. State Colocation: Keep state as close as possible to where it is used to prevent the entire app tree from re-rendering.
  5. Modern Features: Leverage React Server Components (RSC) in Next.js to move heavy logic to the server and reduce client-side JS.

中文翻译:

  1. 跳过不必要的重渲染:使用 React.memo 包裹组件,使用 useCallbackuseMemo 来稳定引用和计算值。
  2. 代码拆分:使用 React.lazySuspense 按需加载组件,减少初始包体积。
  3. 列表优化:始终使用稳定且唯一的 key。对于超长列表,使用“窗口化”或“虚拟滚动”(如 react-window)。
  4. 状态就近管理:将状态尽可能保留在使用的组件内部,防止引起整个应用树的连锁重渲染。
  5. 现代特性:利用 Next.js 中的 服务端组件 (RSC) 将重逻辑移至服务端,减少客户端 JS 负担。

37. What is the difference between React.PureComponent and React.Component?

Both Component and PureComponent are used to create class components, but they handle re-rendering differently:

38. How does React handle re-rendering when state or props change?

Components automatically re-render when their state or props change, but React optimizes this process using the virtual DOM:

39. What is the difference between controlled and uncontrolled components in terms of rendering?

Form inputs can be controlled or uncontrolled, and this affects how they are rendered and updated:

40. How do useMemo and useCallback help improve performance in React?

In React, re-renders can be expensive if functions or computed values are recreated unnecessarily. useMemo and useCallback help optimize rendering by caching values and functions:

 

React Arrays & Lists Questions:

41. How do you render a list of items in React?

In React, lists are usually rendered using JavaScript’s .map() method. Each list item should also have a unique key prop so React can efficiently track and update elements.

In this Example, .map() is used to iterate over the array, and the key prop helps React identify each list item uniquely.

在 React 中,我们使用 JavaScript 的 .map() 方法来遍历数组并返回一个 JSX 元素数组。

42. Why is the key prop important in React lists?

The key prop is important because it helps React efficiently manage list rendering. It allows React to identify which items have changed, been added, or removed, instead of re-rendering the entire list.

中文翻译: Key 是列表中每个元素的唯一标识符。它们帮助 React 的协调 (Reconciliation) 过程:

  1. 识别变化:确定哪些项被添加、移除或修改了。
  2. 提升性能:React 无需重新渲染整个列表,而是通过移动现有的 DOM 节点来完成更新,速度极快。
  3. 保持状态完整性:如果没有稳定的 Key,React 可能会丢失组件的局部状态(例如输入框的值或焦点状态)。

43. What happens if we use the array index as a key in React?

Using the array index as a key technically works, but it is not recommended in most cases. If the list changes (items are reordered, added, or removed), React may reuse components incorrectly, leading to UI bugs.

It is safe only for static lists that never change.

 

中文翻译: 使用索引作为 Key 是最后的手段。如果列表会发生变化(排序、过滤、增删),则应避免使用索引。

44. How do you conditionally render list items in React?

In React, list items can be conditionally rendered using techniques like if statements, ternary operators, or array methods such as .filter() combined with .map().

Example:

45. How do you update or remove an item from a list in React state?

State is immutable, so you cannot modify arrays directly. Instead, you create a new array using methods like .map() or .filter() and then update state with that new array.

Example (removing an item):

In this example, .filter() creates a new array without the removed item, and setList updates the state.

46. What are some performance tips when rendering large lists in React?

Rendering very large lists can hurt performance, so React provides techniques and best practices to optimize them:

47. How would you render a nested list in React?

You can nest .map() calls: one for the parent array and another for the child array.

Example:

In this example, each level of data gets its own .map() loop, and both parent and child elements should have unique key props.

48. How do you handle dynamic addition of items in a list?

In React, since state is immutable, you cannot directly modify the existing array. Instead, you create a new array that includes the new item and update state.

Example:

In this example:

49. How do you handle dynamic sorting or filtering of lists in React?

In React, lists are usually stored in state, and you can sort or filter them dynamically by creating a new array based on the original list and updating the state.

Example:

In this example:

50. What is the difference between rendering lists with map() vs forEach()?

When rendering lists, it’s important to return JSX elements for each item. The choice between map() and forEach() affects this:

Example using map():

In this example:

 

React Forms & Events Questions:

51. How are forms handled in React compared to plain HTML?

In plain HTML, the browser’s DOM manages form data. In React, form inputs are usually controlled components:

In this example, the input is fully controlled by React through value and onChange.

52. How do you prevent the default form submission behavior in React?

By using event.preventDefault() inside the form’s onSubmit handler.

Example:

In this example, the page is stopped from reloading and lets React control what happens on submit.

53. What is event bubbling and how can you stop it in React?

54. How do you handle multiple input fields in a single form in React?

By using a single state object and updating it dynamically with name and value.

Example:

This way, one handler can manage multiple inputs.

55. How do you reset form fields after submission in React?

In React, form inputs are usually controlled components, meaning their values are stored in state. To reset a form, you simply reset the state that controls the inputs:

Example:

In this example:

 

React Routing Questions:

56. What is React Router and why is it used?

React Router is a library that enables client-side routing in React applications. It allows you to create single-page applications (SPAs) where navigation between views happens without a full page reload, making apps faster and smoother.

React Router 是 React 客户端路由的标准库。它允许你创建单页面应用 (SPA),在切换导航时无需重新加载整个页面。通过拦截 URL 的变化并按需渲染组件,它让用户体验变得更快速、更流畅。

57. Difference between <a> tag and <Link> in React Router?

中文翻译:

58. What are the main components of React Router?

中文翻译:

59. What is the difference between useHistory and useNavigate?

中文翻译:

60. How do you implement nested routes in React Router?

English Answer (Optimized): In v6, you nest <Route> components inside each other. The parent component must use the <Outlet /> component to specify where the child components should be rendered.

中文翻译: 在 v6 中,你将 <Route> 组件互相嵌套。父组件必须使用 <Outlet /> 组件来指定子组件应该在何处渲染。 (示例:访问 /dashboard/profile 时,Profile 组件会出现在 DashboardOutlet 位置。)

61. What are route parameters and how do you access them?

English Answer: Route parameters are dynamic segments of a URL, defined using a colon (e.g., :id). You access them using the useParams hook.

中文翻译: 路由参数是 URL 中的动态部分,使用冒号定义(如 :id)。你可以使用 useParams Hook 来访问它们。

Inside User component:

/users/101 : id = 101

62. How do you redirect a user in React Router?

English Answer:

  1. Declaratively: Use the <Navigate /> component inside a <Route> element.
  2. Programmatically: Use the useNavigate() hook inside a function (e.g., Maps('/login')).

中文翻译:

  1. 声明式:在 <Route> 的 element 中使用 <Navigate /> 组件。
  2. 编程式:在函数中使用 useNavigate() Hook(例如 Maps('/login'))。

Using useNavigate() hook for programmatic redirects.

63. What is the difference between client-side routing and server-side routing?

English Answer:

中文翻译:

64. Difference between <Switch> and <Routes> in React Router

English Answer (Optimized):

中文翻译:

 

Advanced Level

React Advanced Interview Questions - 2025

This set contains the advanced-level questions asked in the interview.

1. What are custom hooks in React?

English Answer (Optimized): Custom Hooks are JavaScript functions whose names start with "use". They allow you to extract and reuse stateful logic across multiple components, adhering to the DRY (Don't Repeat Yourself) principle.

中文翻译: 自定义 Hooks 是以 "use" 开头的 JavaScript 函数。它们允许你在多个组件之间提取并复用有状态的逻辑,遵循 DRY (不写重复代码) 原则。

2. How to optimize a React code?

English Answer (Optimized):

  1. Memoization: Use React.memo, useMemo, and useCallback to prevent unnecessary re-renders.
  2. Code Splitting: Use React.lazy and Suspense for lazy loading components.
  3. Fragment: Use React.Fragment or <>...</> to avoid adding extra nodes to the DOM.
  4. List Optimization: Always use stable, unique keys for list rendering.
  5. State Colocation: Move state as close to where it is used as possible to limit the scope of re-renders.

中文翻译:

  1. 记忆化:使用 React.memouseMemouseCallback 来防止不必要的重复渲染。
  2. 代码拆分:使用 React.lazySuspense 对组件进行懒加载。
  3. Fragment:使用 React.Fragment<>...</> 避免向 DOM 中添加多余节点。
  4. 列表优化:在列表渲染中始终使用稳定且唯一的 key
  5. 状态就近管理:将状态尽可能移动到靠近使用它的地方,以限制重渲染的范围。

3. What is the difference between useref and createRef in React ?

English Answer:

中文翻译:

4. What is React Redux and its benefits?

English Answer (Optimized): React Redux is the official UI binding library for Redux. It allows React components to read data from a Redux store and dispatch actions to update the state. Benefits:

  1. Centralized State: A single "source of truth" for the entire app.
  2. Predictability: State changes follow a strict unidirectional flow.
  3. Debugging: Excellent tooling support (Redux DevTools) for time-travel debugging.
  4. Performance: Components only re-render when the specific data they subscribe to changes.

中文翻译: React Redux 是 Redux 的官方 React 绑定库。它允许 React 组件从 Redux store 中读取数据,并派遣 (dispatch) action 来更新状态。 优点:

  1. 集中化状态:整个应用的单一“事实来源”。
  2. 可预测性:状态变化遵循严格的单向数据流。
  3. 调试友好:拥有强大的工具支持(Redux DevTools),可进行时光倒流调试。
  4. 性能优化:组件仅在它们所订阅的具体数据发生变化时才重新渲染。

6. Explain the core components of react-redux and combining with reducers.

English Answer:

中文翻译:

8. What is context API? Explain provider and consumer in ContextAPI?

English Answer (Optimized): The Context API is a built-in feature to share data across nested components without "prop drilling."

中文翻译: Context API 是 React 内置的功能,用于在嵌套组件间共享数据,避免“Props 钻取”。

10. Explain CORS in React.Axios

In ReactJS, Cross-Origin Resource Sharing (CORS) refers to the method that allows you to make requests to the server deployed at a different domain. As a reference, if the frontend and backend are at two different domains, we need CORS there.

We can setup CORS evironment in frontend using two methods:

11. What is axios and how to use it in React?

Axios, which is a popular library is mainly used to send asynchronous HTTP requests to REST endpoints. This library is very useful to perform CRUD operations.

To install aixos package in react use the following command.

12. Write a program to create a counter with increment and decrement.

Output:

Animationkk

In this example

13. Why use a callback function in state updates?

English Answer (Optimized): State updates in React are asynchronous and may be batched. If you update state based on the previous value (e.g., setCount(count + 1)), it might use a stale value from a previous render. Using a callback (setCount(prev => prev + 1)) ensures you are always working with the latest state, preventing race conditions and bugs.

中文翻译: React 的状态更新是异步的,并且可能会进行批处理。如果你基于旧值更新状态(如 setCount(count + 1)),它可能会使用旧渲染周期中的过时值。 使用回调函数(如 setCount(prev => prev + 1))能确保你始终在最新的状态基础上进行操作,从而防止竞态条件和 Bug。

14. What is React-Material UI?

不需要管。

15. What is flux architecture in redux?

过时了。

16. Explain the useMemo hook in react?

The useMemo is a hook used in the functional component of react that returns a memoized value. In Computer Science, memoization is a concept used in general when we don’t need to recompute the function with a given argument for the next time as it returns the cached result. A memoized function remembers the results of output for a given set of inputs.

17. Does React useState Hook update immediately?

React do not update immediately, although it seems immediate at first glance. React keep track of the states by queuing them in the order they are called. React queue all the changes to be made and update once the component Re-render which is not immediate. This is how React knows which value corresponds to which state. It goes as per the queue every time the component tries to re-render.

18. When to use useCallback, useMemo and useEffect ?

中文翻译:

19. Explain the types of router in React?

There are three types of routers in React:

20. What is StrictMode in React?

The React StrictMode can be viewed as a helper component that allows developers to code efficiently and brings to their attention any suspicious code which might have been accidentally added to the application. The StrictMode can be applied to any section of the application, not necessarily to the entire application.

21. What is Conditional Rendering in React?

Conditional rendering in React means dynamically displaying components or elements based on a condition. Instead of rendering everything at once, React decides what to render based on the current state, props, or logic. We can use conditional rendering when:

22. What is React Router?

已经有答案了。

23. What is the difference between the React Hooks and Classes?

已经有答案了。

24. How Data is passed between the React Components?

In React, data is passed between components using props. The way data flows between components depends on whether they are parent-child, sibling components, or if you're using state management techniques like context or Redux.

25. What is Lazy Loading in React?

English Answer: Lazy Loading is a performance optimization technique that loads components only when they are needed. In React, this is achieved using React.lazy() and <Suspense>. It helps reduce the initial bundle size, leading to faster initial page loads.

中文翻译: 懒加载 (Lazy Loading) 是一种性能优化技术,仅在需要时才加载组件。在 React 中,通过 React.lazy()<Suspense> 来实现。它有助于减少初始包体积,从而加快页面的首次加载速度。

26. Explain Redux and its components.

Redux is a state management library that helps manage the application state globally. React-Redux is used to connect Redux state to React components. There are the three main components of the redux:

27. How React Routing is different from Conventional Routing?

React Routing is used in Single Page Applications (SPAs), while conventional routing typically applies to multi-page applications. Here’s how they differ:

FeaturesReact RoutingConventional Routing
Page LoadingNo full page reload; components are dynamically rendered.Entire page reload happens with every navigation.
SEO ConsiderationsReact Router needs additional configurations (like SSR or dynamic rendering) to optimize SEO.SEO is typically easier to manage since pages are fully rendered by the server.
NavigationNavigation is handled by JavaScript on the client-side, often using Link and NavLink components.Navigation is handled by the server through HTML anchor tags ().
TechnologyManaged via React Router; uses client-side routing.Managed by server-side routing (e.g., Express, PHP).
URL StructureURLs can have dynamic parameters handled by React Router (e.g., /product/:id).URLs are typically static and are managed by the server.

English Answer: The main difference lies in how the browser handles transitions:

中文翻译: 主要区别在于浏览器如何处理页面切换:

28. How to avoid binding in ReactJS?(已过时,不用看)

 

29: What are props in React?

In React, props (short for "properties") are a way of passing data from a parent component to a child component. Props are read-only and are used to customize or control the behavior of a component. They help make components reusable and dynamic by allowing different data to be passed into them.

30. What is the use of CSS modules in React?

CSS Modules help you keep your styles specific to each React component, so they don't affect other components. In simple terms, it lets you write CSS for one component without worrying about messing up the styles of other parts of your app. This is especially useful when your app grows larger and has many components, making it easier to manage styles without conflicts.