react redux中组件和容器的区别 [英] Difference between component and container in react redux

查看:26
本文介绍了react redux中组件和容器的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

react redux 中的组件和容器有什么区别?

What is the difference between component and container in react redux?

推荐答案

Component 是 React API 的一部分.组件是描述 React UI 一部分的类或函数.

Component is part of the React API. A Component is a class or function that describes part of a React UI.

Container 是 React 组件的非正式术语,该组件connect 连接到 redux 存储.容器接收 Redux 状态更新和 dispatch 动作,它们通常不渲染 DOM 元素;他们将渲染委托给展示性子组件.

Container is an informal term for a React component that is connect-ed to a redux store. Containers receive Redux state updates and dispatch actions, and they usually don't render DOM elements; they delegate rendering to presentational child components.

有关详细信息,请阅读 Dan Abramov 的展示组件与容器组件.

For more detail read presentational vs container components by Dan Abramov.

这篇关于react redux中组件和容器的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆