S
S
Stepan2015-12-27 03:53:34
JavaScript
Stepan, 2015-12-27 03:53:34

How to track the status of the Store?

I change the state from the child. (sorting)
Sending

sortChange(sortType) {
    switch (sortType){
      case 'BY NUMBER OF NOTES':
        return this.props.dispatch(filterSortByNotes(this.props.name));
      case 'ALPHABETYCALLY':
        return this.props.dispatch(filterSortByAB(this.props.name));
    }
    this.setState({
      sortType: sortType
    })
  },

I accept
case FILTERS.ACTION_TYPES.FILTER_SORT_BY_NOTES:
      return  state.set(dataType, state.get(dataType).sort((a, b) => a.notes - b.notes));

Everything is changing, everything is good. But the parent is not redrawn, but remains as it was.
How to hang the listener, I did not understand. How else can you track store changes and rerender?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Antropov, 2015-12-27
@Laiff

If used together with React, then you can look here rackt.org/redux/docs/basics/UsageWithReact.html
If with another framework, then you need to do something similar in functionality to connect, although most likely there are already bindings

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question