Created
February 25, 2019 13:37
-
-
Save pheew/5b13f6093d97ba6e4090128e135a011f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react' | |
import { Persistor, persistStore } from 'redux-persist' | |
import { PersistGate } from 'redux-persist/integration/react' | |
const WithPersistGate = (Component) => (props) => { | |
if (!props.store.persistor) { | |
props.store.persistor = persistStore(props.store) | |
} | |
return ( | |
<PersistGate persistor={props.store.persistor}> | |
<Component {...props} /> | |
</PersistGate> | |
) | |
} | |
export default WithPersistGate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment