P
P
Pogran2016-09-16 17:58:33
React
Pogran, 2016-09-16 17:58:33

How to load data differently in a component?

I am creating a json tree. there is such a route

<Route path="entity/edit/:entity_id" component={EntityForm} />

Then in EntityForm
componentWillMount() {
    if(!isEmpty(this.props.entity_id)) {
      this.props.actions.loadEntityRequest(this.props.entity_id) //  устанавливает в reducer начальные данные структуры(entity)
    }
  }

Then I get the data via mapStateToProps
const mapStateToProps = (state, ownProps) => {
  return {
    entity: state.entity
  }
};

What a big problem for me. I get the structure every time I change it through mapStateToProps and it turns out that when the state changes, the tree is completely rebuilt. Is it possible to somehow get the initial data in a different way, so as not to be tied to the state?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question