mardi 1 mai 2018

how to normalize react-redux state Memoize?

I have a list of ids of selected universities. And there is student containing student_id and university_id. I want to fetch all student related to a selected university using react-redux selector.

If this is university state:

export interface University{    
    universityMap: { [universityId: string]: University; };
    universityList: string[];
}

and this is student state:

export interface Student{    
    studentMap: { [studentId: string]: Student[]; };
}

How can i modify Student state and apply a selector to return all student of a selected university on base of universityId?




Aucun commentaire:

Enregistrer un commentaire