简体   繁体   English

react-redux 提供者的上下文实例属性是什么?

[英]What is the context instance prop of react-redux provider?

I was reading about React-Redux provider in the library docs and i faced 'context instance' prop as one prop for the provider, i couldn't really understand what it means:我正在图书馆文档中阅读有关React-Redux 提供者的信息,我遇到了“上下文实例”道具作为提供者的一个道具,我无法真正理解它的含义:

context You may provide a context instance. If you do so, you will need to provide the same context instance to all of your connected components as well. Failure to provide the correct context results in runtime error:

Is it the whole store data??是全店数据吗?? the destination component of data??数据的目标组件??

Is it the whole store data??是全店数据吗?? the destination component of data??数据的目标组件??

No, the context props is a react context instance, which allow you using store directly in its consumer instead of through connect , useSelector or useStore .不, context道具是一个反应上下文实例,它允许您直接在其消费者中使用store ,而不是通过connectuseSelectoruseStore As its doc, you can either create your custom context or using redux's ReactReduxContext作为其文档,您可以创建自定义上下文或使用 redux 的ReactReduxContext

暂无
暂无

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

相关问题 prop`store`如何在react-redux Provider中工作? - How does the prop `store` work in react-redux Provider? 什么是React-Redux环境中的“撕裂”? - What is “Tearing” in the context of the React-Redux? 提供者react-redux中的错误 - Error in Provider react-redux React-Redux错误提供给提供者的对象类型为对象的无效子属性prop - React-Redux error Invalid prop `children` of type `object` supplied to `Provider` 错误:找不到 react-redux 上下文值; 请确保组件被包裹在一个<provider> : Redux 与 NextJS</provider> - Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>: Redux with NextJS 用react-redux绑定事件处理程序prop - Binding event handler prop with react-redux 错误:找不到 react-redux 上下文值; 请确保组件被包裹在一个<provider></provider> - Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider> 我的测试失败了,因为“找不到 react-redux 上下文值; 请确保组件被包裹在一个<Provider> ” - My tests are failing because of “could not find react-redux context value; please ensure the component is wrapped in a <Provider>” 错误:找不到 react-redux 上下文值; 请确保组件被包裹在一个<Provider>在使用 useselector 时 - Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider> while using useselector 开玩笑说:“找不到 react-redux 上下文值;请确保组件包装在<provider> "</provider> - In jest : "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM