1

I have a next app with next-redux-wrapper and my store code

import { createStore, applyMiddleware } from "redux";
import reducer from "./reducers";
import reduxThunk from "redux-thunk";

export default (initialState = undefined, { storeKey = "app" }) => {
  return createStore(reducer, initialState, applyMiddleware(reduxThunk));
};

I am importing the store and export app withRedux next-redux-wrapper

All things works fine but I want to access the store from non component files

import store from "../redux/store";
export const lang = store(undefined, { storeKey: "app" }).getState().user
  .language;

lang not changed when I change it in main store

juliomalves
  • 42,130
  • 20
  • 150
  • 146
  • Does this answer your question? [Access Redux store outside React when using next-redux-wrapper](https://stackoverflow.com/questions/56805679/access-redux-store-outside-react-when-using-next-redux-wrapper) – Linda Paiste Mar 28 '21 at 23:14

0 Answers0