-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider> #3287
Comments
Hello @KenAdams777. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Try to point your |
Thanks, it worked for me.
/* eslint-disable import/no-extraneous-dependencies */
/// <reference types="vitest" />
/// <reference types="vite/client" />
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import path from "path";
export default defineConfig({
plugins: [react()],
test: {
globals: true,
environment: "jsdom",
setupFiles: ["./tests/setupTests.ts"],
alias: [
{
find: "react-redux/es/exports",
replacement: path.resolve(__dirname, "./node_modules/react-redux/lib/exports"),
},
],
coverage: {
provider: "c8",
reportsDirectory: "./tests/_coverage",
},
},
}); |
Describe the bug
Despite the component being wrapped into Provider with created store, it still keeps getting
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
.As you can see from the
log
screenshot, the store is being created correctly but still, Provider can not get its value, and in thenode_modules/react-redux/es/hooks/useReduxContext
file thecontexValue
is gettingnull
instead.Reproduction
Here is the Link to the repo with minimal reproduction:
System Info
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: