Mezhinsky Dmitry
Mezhinsky Dmitry

Reputation: 21

React-redux-firebase populate with createStructuredSelector from reselect

im using react-redux-firebase with populate method to mix data from collection and everything fine except i can't using createStructuredSelector with mapStateToProps from redux because createStructuredSelector replace it so i looking for solution how to combine this to things

const mapStateToProps = (state: any) => {
  const items = populate(state.firestore, 'Skill', populates);

  const seletors = createStructuredSelector({
    loading: makeSelectFSCollectionStatus('requesting', COLLECTION),
    skills: makeSelectFSCollectionOrdered(COLLECTION),
  });
  return seletors;
}

i need to insert items into seletors somehow

Upvotes: 0

Views: 47

Answers (1)

Mezhinsky Dmitry
Mezhinsky Dmitry

Reputation: 21

found solution

const mapStateToProps = (state: any) => {
  const items = populate(state.firestore, 'Skill', populates);

  const seletors = createStructuredSelector({
    loading: makeSelectFSCollectionStatus('requesting', COLLECTION),
    skills: makeSelectFSCollectionOrdered(COLLECTION),
  });

  const t: any = seletors(state);
  t.items = items;

  return t;
};

Upvotes: 0

Related Questions