简体   繁体   English

Redux 工具包和 React Native。 错误:找不到 react-redux 上下文值;

[英]Redux ToolKit and React Native. Error: could not find react-redux context value;

I was following all the Quick Start tutorial for Redux Toolkit, but it's throws me the following error:我正在关注 Redux Toolkit 的所有快速入门教程,但它向我抛出了以下错误:

Error: could not find react-redux context value;错误:找不到 react-redux 上下文值; please ensure the component is wrapped in a Provider请确保组件包装在 Provider 中

I don't know why, the Provider wrappe my App.js component and I dont use any Redux Hook inside the App component我不知道为什么,Provider 包装了我的 App.js 组件,我没有在 App 组件内使用任何 Redux Hook

This is my App component:这是我的应用组件:

import React from "react";
import { NavigationContainer } from '@react-navigation/native';
import { createDrawerNavigator } from "@react-navigation/drawer";
import CustomDrawer from "./Components/CustomDrawer.jsx";
import Authentication from "./Pages/Authentication.jsx";
import Home from "./Pages/Home.jsx";
import { store } from "./Redux/Store.js";
import { Provider } from "react-redux";



const Drawer = createDrawerNavigator();


export default function App() {
  return (
    <Provider store={store}>
      <NavigationContainer>
        <Drawer.Navigator 
        screenOptions={{ 
          headerStyle: { 
            elevation: 0, 
            shadowOpacity: 0 
          }, 
          headerTransparent: true,
          headerTitle: '' 
        }} 
        drawerContent={(props) => <CustomDrawer  {...props} />}>

          <Drawer.Screen 
          name="Home" 
          component={Home} 
          />
          <Drawer.Screen 
          name="Register" 
          component={Authentication} 
          />
        </Drawer.Navigator>
      </NavigationContainer>
    </Provider>
  )
}

I have also seen the React Navigator documentation and it does not say anything about it.我还看过 React Navigator 文档,但它没有说明任何内容。

Somehow I solved the bug.... All I did was reposition my Drawe.Screen components, refresh the application and then put them back as they were.不知何故我解决了这个错误......我所做的只是重新定位我的 Drawe.Screen 组件,刷新应用程序,然后将它们放回原样。 I don't know what happened but somehow it fixed it.我不知道发生了什么,但它以某种方式修复了它。

暂无
暂无

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

相关问题 找不到 react-redux 上下文值错误随机触发 - could not find react-redux context value error triggering randomly 错误:找不到 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 上下文值; 请确保组件被包裹在一个<provider></provider> - Error: 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 使用 useContext 钩子获取“错误:找不到 react-redux 上下文值;请确保组件包装在<provider> "</provider> - using useContext hook get "Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>" Webpack5 模块联合:“未捕获的错误:找不到 react-redux 上下文值; 请确保组件被包裹在一个<provider> ”</provider> - Webpack5 Module Federation: “Uncaught Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>” React Native - react-redux PropTypes 错误 - React Native - react-redux PropTypes error 开玩笑说:“找不到 react-redux 上下文值;请确保组件包装在<provider> "</provider> - In jest : "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:找不到“商店” - React-redux: Could not find “store”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM