Guest User

Untitled

a guest
Nov 12th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. const getIn = (state, path) => {
  2. if (!state) {
  3. return state
  4. }
  5.  
  6. const length = path.length
  7. if (!length) {
  8. return undefined
  9. }
  10.  
  11. let result = state
  12. for (let i = 0; i < length && !!result; ++i) {
  13. result = result[path[i]]
  14. }
  15.  
  16. return result
  17. }
  18.  
  19. const merge = (state,paylod) => ({...state, ...payload})
  20.  
  21. getIn(state, ['router', 'location'])
Add Comment
Please, Sign In to add comment