rt2zz / redux-persist

persist and rehydrate a redux store
MIT License
12.94k stars 866 forks source link

Index Readme could help show how to import the bundle {store, persist} from the App code #846

Open taboca opened 6 years ago

taboca commented 6 years ago

Notice a bug with a lot of people trying to get the destructuring right based on the fact that this lib uses the configStore to return an object with two objects inside.

Perhaps the main readme could also show how would the import look like for the "App.js"

The section, to be patched would be this:

import { PersistGate } from 'redux-persist/integration/react'
import { store, persistor } from 'storeConfig' 

// ... normal setup, create store and persistor, import components etc.

const App = () => {
  return (
    <Provider store={store}>
      <PersistGate loading={null} persistor={persistor}>
        <RootComponent />
      </PersistGate>
    </Provider>
  );
};
shirakaba commented 6 years ago

I'll admit that I was lost at what to do here. However, your import of "storeConfig" needs clarification, too!

Should <Provider> really be the parent of <PersistGate>? Thought it would be the other way round, from the docs.

linux08 commented 5 years ago

Hi , I noticed this is an issue so I updated the readme. I just made a PR https://github.com/rt2zz/redux-persist/pull/917