Advertisement
Guest User

Untitled

a guest
Jan 30th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Action, Reducer, ActionCreator } from 'redux';
  2.  
  3. export interface NavbarState {
  4.     visible: string
  5. }
  6.  
  7. export interface ToggleVisibilityAction { type: 'TOGGLE_VISIBILITY' }
  8.  
  9. type KnownAction = ToggleVisibilityAction;
  10.  
  11. export const actionCreators = {
  12.     toggleNav: () => <ToggleVisibilityAction>{ type: 'TOGGLE_VISIBILITY' }
  13. };
  14.  
  15. export const reducer: Reducer<NavbarState> = (state: NavbarState, action: KnownAction) => {
  16.     switch (action.type) {
  17.         case 'TOGGLE_VISIBILITY':
  18.             return { visible: state.visible + "." };
  19.     }
  20.     return state || { visible: "start" };
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement