Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { normalize } from 'normalizr';
- let normalizeData = normalize(todosResponse, responseSchema);
- console.log(normalizedData);
- // Outputs:
- // {
- // "entities": {
- // "User": {
- // "38": {
- // "id": 38,
- // "name": "Leanne Graham",
- // "email": "Sincere@april.biz"
- // }
- // },
- // "Todo": {
- // "32": {
- // "id": 32,
- // "text": "Buy cheese",
- // "completed": false,
- // "author": 38
- // },
- // "33": {
- // "id": 33,
- // "text": "Clean laundry",
- // "completed": true,
- // "author": 38
- // }
- // }
- // },
- // "result": {
- // "status": 200,
- // "body": [32, 33]
- // }
- // }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement