Подключаю так:
import '../styles/styles.sass';
import type { AppProps } from 'next/app';
import { applyMiddleware, createStore } from 'redux';
import allReducers from '../redux/allReducers';
import { Provider, useDispatch } from 'react-redux';
import thunk from 'redux-thunk';
import { composeWithDevTools } from 'redux-devtools-extension';
import React from 'react';
import { useRouter } from 'next/router';
import { auth } from '../actions/userActions';
import { IMessage } from '../interfaces';
const store = createStore(allReducers, composeWithDevTools(applyMiddleware(thunk)));
const MyApp = ({ Component, pageProps }: AppProps) => {
const router = useRouter();
const dispatch = useDispatch();
const [message, setMessage] = React.useState<IMessage>({
type: "", text: ""
});
const [load, setLoad] = React.useState(true);
React.useEffect(() => {
dispatch(auth(router, setMessage, setLoad));
// eslint-disable-next-line
}, [router]);
return (
<Provider store={store}>
<Component {...pageProps} />
</Provider>
)
}
export default MyApp
Ошибка:
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>