rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.91k stars 862 forks source link

Using redux persist with redux-thunk and nextjs #1181

Open ratnabh opened 4 years ago

ratnabh commented 4 years ago

I was trying to add redux-persist while using nextjs and redux-thunk in my app but didn't find any progress in it.

Here is my code for that

import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk from 'redux-thunk';
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage' // defaults to localStorage for web
import reducer from './reducers';

export const makeStore = (initialState, options) => {
    return createStore(reducer, initialState, composeWithDevTools(applyMiddleware(thunk)));
};

so this is a setup of redux thunk with nextjs and now can someone help me with the setup of redux persist here ?

muratdogan17 commented 4 years ago

Could you find any working solution about that?

egemon commented 4 years ago

https://www.robinwieruch.de/redux-persist-next-js

egemon commented 4 years ago

https://github.com/kirill-konshin/next-redux-wrapper#usage-with-redux-persist