Moves navigation to the state
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user