问题:当导出的函数被React组件调用时,console.log(this)显示未定义。我原以为它会返回组件,因为我已经将它绑定在构造函数中。Leaderboard.js:import {leaderboard, createLeaderboard} from '../utility/gamecode';
class Leaderboard extends React.Component{
如果我在componentDidUpdate()中分派该操作,则该操作将无限期执行,如果我使用constructor(props),我将得到props的未定义值,我也尝试了componentDidMount,但对于probs,我得到了未定义的值。是否有一种使用react 分派动作的方法?import {connect} from '