Skip to content

Instantly share code, notes, and snippets.

@micahnz
Created February 22, 2017 21:49
Show Gist options
  • Save micahnz/0104e24806144bf368b76f3d43dbac3c to your computer and use it in GitHub Desktop.
Save micahnz/0104e24806144bf368b76f3d43dbac3c to your computer and use it in GitHub Desktop.
//
export const setSocketId = createVersionedReducer()
.addVersion('^1 < 1.2', (state, action) => {
return state.set('sid', action.payload.id);
})
.addVersion('^1.2 < 1.3', (state, action) => {
return state.set('sid', action.payload.id);
})
.addVersion('>=1.3.0 <2.0.0', (state, action) => {
return state.set('sid', action.payload.id);
})
.addVersion('1.0.0', (state, action) => {
return state.set('socketId', action.payload.id);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment