React Redux中组件和容器之间的差异 [英] Difference between component and container in react redux

查看:47
本文介绍了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.

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

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天全站免登陆