Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Action, Reducer, ActionCreator } from 'redux';
- export interface NavbarState {
- visible: string
- }
- export interface ToggleVisibilityAction { type: 'TOGGLE_VISIBILITY' }
- type KnownAction = ToggleVisibilityAction;
- export const actionCreators = {
- toggleNav: () => <ToggleVisibilityAction>{ type: 'TOGGLE_VISIBILITY' }
- };
- export const reducer: Reducer<NavbarState> = (state: NavbarState, action: KnownAction) => {
- switch (action.type) {
- case 'TOGGLE_VISIBILITY':
- return { visible: state.visible + "." };
- }
- return state || { visible: "start" };
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement