loading
1. The use of conventional
Began to write most loading
of the time is set in the assembly
state = {
loading: false;
};
Then do when a data request loading
switch
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