loading use

loading


1. The use of conventional

Began to write most loadingof the time is set in the assembly

state = {
  loading: false;
};

Then do when a data request loadingswitch

const test = () => {
  this.setState({
    loading: true;
  });
  // 相关操作,数据请求或者等等
  this.setState({
    loading: false;
  });
}

Need to write your own <loading />assembly time, so you can use

{loading && <loading />}

2. others written method

With connect()use

@connect(({ loading }) => ({
  fetching: loading.effects['[model文件名]/[方法]'],
}))

Such an approach, by eliminating the need for the process of writing the setting switch

Published 23 original articles · won praise 0 · Views 565

Guess you like

Origin blog.csdn.net/JIANLI0123/article/details/103823778