我试图将身份验证信息放入React组件并获取与已身份验证的用户有关的数据,但是除非使用setTimeOut,否则componentDidmount不会从redux存储中获取auth值。 我该怎么办?
我尝试了componentWillReceiveProps(),但这也不起作用。
class Dashboard extends Component {
componentDidmount = () => {
console.log(this.props.auth);
setTimeout(
() => console.log(this.props.auth),100
)
}
setTimeout中只有console.log返回值