Skip to content

Commit

Permalink
https://github.com/aohua/redux-state-sync/issues/108
Browse files Browse the repository at this point in the history
  • Loading branch information
rowrowrowrow committed Jul 12, 2022
1 parent 3e9b31a commit 6f88fbd
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 @@ -217,6 +217,22 @@ const config = {
const middlewares = [createStateSyncMiddleware(config)];
```

#### receiveState

Reconcile the incoming state from other tabs with the existing state.

type: `Function`

default: (prevState, nextState) => nextState

```javascript
const config = {
// Overwrite existing state with incoming state
receiveState: (prevState, nextState) => nextState,
};
const middlewares = [createStateSyncMiddleware(config)];
```

```javascript
import { combineReducers } from 'redux-immutable';
import { withReduxStateSync } from 'redux-state-sync';
Expand All @@ -225,5 +241,6 @@ const rootReducer = combineReducers({
visibilityFilter,
});

export default withReduxStateSync(appReducer, state => Immutable.fromJS(state));
// Overwrite existing state with incoming state
export default withReduxStateSync(appReducer, (prevState, nextState) => nextState);
```

0 comments on commit 6f88fbd

Please sign in to comment.