Open skout90 opened 6 years ago
Hello! Thanks for your demo project. It works well!
I use rematch-persist to save state. But it dont works well. persist dont save any state.
Could you give me some hint for this??
My code is like below.
import {init} from '@rematch/core' import createRematchPersist from '@rematch/persist'
import * as models from './models' import withRematch from 'src/store/utils/withRematch'
const persistPlugin = createRematchPersist({ throttle: 5000, version: 1, })
const initStore = (initialState = {}) => init({ plugins: [ persistPlugin ], models, redux: {initialState} })
export {initStore, withRematch}
- _app.js (in next js) ```javascript import App, {Container} from 'next/app' import React from 'react' import { getPersistor } from '@rematch/persist' import { PersistGate } from 'redux-persist/lib/integration/react' const persistor = getPersistor() export default class MyApp extends App { render () { const {Component, pageProps} = this.props return ( <PersistGate persistor={persistor}> <Container> <Component {...pageProps} /> </Container> </PersistGate> ) } }
Thanks! Have a good weekends :)
Actually, I've been looking into react-persist as well but haven't finished a proper example yet. Thanks for the interest, I'll let you know, maybe this week-end.
@millette Thanks :+1:
Hello! Thanks for your demo project. It works well!
I use rematch-persist to save state. But it dont works well. persist dont save any state.
Could you give me some hint for this??
My code is like below.
import * as models from './models' import withRematch from 'src/store/utils/withRematch'
const persistPlugin = createRematchPersist({ throttle: 5000, version: 1, })
const initStore = (initialState = {}) => init({ plugins: [ persistPlugin ], models, redux: {initialState} })
export {initStore, withRematch}
Thanks! Have a good weekends :)