Moves navigation to the state

This commit is contained in:
Sofiya Tepikin
2019-09-15 18:59:11 +02:00
parent f444de0b87
commit e479b93638
13 changed files with 254 additions and 202 deletions
+26
View File
@@ -0,0 +1,26 @@
import { createSlice } from 'redux-starter-kit'
const navigationSlice = createSlice({
slice: 'navigation',
initialState: {
current: 'Home',
prev: null,
},
reducers: {
navigate: (state, action) => {
return {
current: action.payload,
prev: state.current
}
}
}
})
// Extract the action creators object and the reducer
const { actions, reducer, selectors } = navigationSlice
// Extract and export each action creator by name
export const { navigate } = actions
export const { getNavigation } = selectors
export default reducer