NetanelBasal
7/4/2018 - 4:03 PM

normalizr.ts

import { schema, normalize } from 'normalizr';

const actor = new schema.Entity('actors');
const genre = new schema.Entity('genres');
const movie = new schema.Entity('movies', {
  genres: [genre],
  actors: [actor],
});

export const getMovies = serverResponse => normalize(serverResponse, [movie]);