This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // We're going to create our own pipe function! | |
| // Some basic functions for easily understand the pipe function. | |
| // We'll combine those three function and send the value 4 to it. | |
| // Getting result of - 'The numner is: 10' | |
| const add1 = x => x + 1; | |
| const mul2 = x => x * 2; | |
| const title = x => `The number is: ${x}`; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import {Reducer} from 'redux'; | |
| // The IState interface. | |
| // It's empty becuase each state looks differntly. | |
| export interface IState {}; | |
| // That's the action we send to our reducer for initializie | |
| // No switch case should catch this action, it's for initialization only | |
| export const INIT_ACTION = 'HIGH_ORDER_INIT_ACTION'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // IState is just an empty interface and all states should extend it. | |
| export interface IExampleState extends IState { | |
| parameter1: number, | |
| parameter2: string[] | |
| }; | |
| export const exampleInitialState: IExampleState = { | |
| parameter1: 0, | |
| parameter2: [] | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export interface ITabState extends IState { | |
| selectedTab: number; | |
| }; | |
| export const tabInitialState: ITabState = { | |
| selectedTab: 0, | |
| }; | |
| // We use a curry here so we could use our extendReducer Function | |
| // An HOR can get as many arguments as it needs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Main public safes state | |
| export interface ISafesState extends ISafesBaseState, | |
| IErrorState, | |
| IMasterDetailsState, | |
| ITabState | |
| {} | |
| // Private base safe state | |
| interface ISafesBaseState extends IState { | |
| dataListSettings: IFlattenState; |