React Component Lifecycle
- getInitialState
- getDefaultProps
- componentWillMount
- componentDidMount
- shouldComponentUpdate (Update only)
- componentWillUpdate (Update only)
- componentWillReceiveProps (Update only)
- render
| // setup | |
| const wait = value => new Promise(resolve => { | |
| setTimeout(() => resolve(value), 3000); | |
| }); | |
| const fetchFoo = () => wait('foo'); | |
| const fetchBar = () => wait('bar'); | |
| const fetchBaz = () => wait('baz'); | |
| const fetchDataSlowly = async time => { |
| // ensure the keys being passed is an array of key paths | |
| // example: 'a.b' becomes ['a', 'b'] unless it was already ['a', 'b'] | |
| const keys = ks => Array.isArray(ks) ? ks : ks.split('.') | |
| // traverse the set of keys left to right, | |
| // returning the current value in each iteration. | |
| // if at any point the value for the current key does not exist, | |
| // return the default value | |
| const deepGet = (o, kp, d) => keys(kp).reduce((o, k) => o && o[k] || d, o) |
React Component Lifecycle
| [user] | |
| email = <your email> | |
| name = <yout name> | |
| [alias] | |
| ci = commit | |
| st = status | |
| s = status | |
| a = !git add -A && git status | |
| co = checkout |