简体   繁体   English

Redux、React 状态更新和重新渲染组件

[英]Redux, React state update and re-render component

  1. How exactly re-rendering of the components happen if there is a new state object returned from the redux reducer..?如果 redux reducer 返回了一个新的 state 对象,组件的重新渲染究竟是如何发生的?
  2. Are there any optimisation techniques used by react to minimalize the rendering of components ..? react 是否使用任何优化技术来最小化组件的渲染..?

When you connect a component to the redux store, and you map the redux state to props, if a state changes into a new state, the component re-renders.当您将组件连接到 redux 存储,并将 redux 状态映射到 props 时,如果状态更改为新状态,则组件会重新渲染。 Just like when you pass a state to a child component and that state changes.就像您将状态传递给子组件并且该状态发生变化时一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 一段时间不活动后,React Redux更新(重新渲染)组件 - React Redux update (re-render) a component after a period of inactivity state 更新后 React 不会重新渲染组件 - React does not re-render component after state update React / Redux:状态在Redux对象中更新,但是React组件不会重新渲染 - React/Redux: State is updated in Redux object, but React component doesn't re-render 更改Redux状态时,组件不会重新渲染-React - Component doesn't re-render when Redux state is changed - React 当 redux 连接状态改变时,有状态的本机功能组件不会重新渲染 - Stateful react-native functional component don't re-render when redux connected state change 使用 react、redux 和 immer 更新状态时,组件不会重新渲染 - Component does not re-render when State is updated using react, redux and immer 当redux状态更改时,应该使用哪种React循环方法重新渲染组件? - Which React cycle method should I use to re-render component when redux state has changed? 尽管Redux状态已更新,但组件未重新渲染 - Component does not re-render although redux state is updated 在 Redux state 更改后重新渲染组件不起作用? - Re-render Component after Redux state change not working? 在Redux Store中的状态更改中重新渲染组件 - Re-Render in component on State Change in Redux Store
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM