Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. import { normalize } from 'normalizr';
  2.  
  3. let normalizeData = normalize(todosResponse, responseSchema);
  4.  
  5. console.log(normalizedData);
  6. // Outputs:
  7. // {
  8. // "entities": {
  9. // "User": {
  10. // "38": {
  11. // "id": 38,
  12. // "name": "Leanne Graham",
  13. // "email": "Sincere@april.biz"
  14. // }
  15. // },
  16. // "Todo": {
  17. // "32": {
  18. // "id": 32,
  19. // "text": "Buy cheese",
  20. // "completed": false,
  21. // "author": 38
  22. // },
  23. // "33": {
  24. // "id": 33,
  25. // "text": "Clean laundry",
  26. // "completed": true,
  27. // "author": 38
  28. // }
  29. // }
  30. // },
  31. // "result": {
  32. // "status": 200,
  33. // "body": [32, 33]
  34. // }
  35. // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement