我现在的目标是显示一个状态符号,当我的应用程序从数据库中获取信息时,该符号会闪烁,我想通过向商店添加标记来实现这一点。基本上,我只是希望在获取信息时显示该符号,然后在之后消失。这就是我尝试这样做的方式:
reducer.js:
switch (action.type) {
case 'APPS_LIST_INITIATED':
console.log("APPS_LIST_INITIATED");
var cpy = Object.assign({}, state);
cpy.apps = [];
console.log("Trying to add status flag to the state");
cpy.statusFlag = true;
return cpy;
app_listing.jsx
:
<div style={{opacity: "0.6", float: "right"}}>
{
(this.props.statusFlag) ?
<CircularProgress
size={.4}
thickness={2}
style={{
position: "relative",
height: "20px",
top: "-15px"
}}
/>
: ""
}
</div>
这是我到目前为止所尝试过的,但我发现statusFlag
中甚至不存在this.props
。实现这一目标的最佳方法是什么?