Skip to content

Commit

Permalink
Improve documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
zewish committed Aug 16, 2023
1 parent dcc27b5 commit a59a911
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Usage - react-native
--------------------

```ts
import AsyncStorage from '@react-native-community/async-storage';
import AsyncStorage from '@react-native-async-storage/async-storage';
import { configureStore, createSlice, PayloadAction } from '@reduxjs/toolkit';
import { rememberReducer, rememberEnhancer } from 'redux-remember';

Expand Down Expand Up @@ -186,6 +186,23 @@ const myReducer = createSlice({
state.persisted = true;
})
});

const reducers = {
myReducer: myReducer.reducer,
// ...
};

const reducer = rememberReducer(reducers);
const store = configureStore({
reducer,
enhancers: [rememberEnhancer(
window.localStorage, // or AsyncStorage, or your own custom storage driver
rememberedKeys,
{ persistWholeStore: true }
)]
});

// Continue using the redux store as usual...
```

Usage - legacy apps (without redux toolkit)
Expand Down

0 comments on commit a59a911

Please sign in to comment.