是Reactjs的新手。我真的不明白props和state是如何工作的。从我的研究中,我发现道具是从父母传给孩子的。而且状态只能在单个组件中使用。但是,当我在下面看到这些代码时,我不知道它是如何工作的。有人可以给我一个很好的例子和解释。谢谢
不仅是let和var之间的区别是什么>>
default class WildList extends React.Component { constructor(props){ super(props); this.props = props; let {keyword, dealstatus} = this.props; this.state = { keyword } } }
PS =该WildList类也正在不同的组件中使用。
是Reactjs的新手。我真的不明白道具和状态是如何工作的。从我的研究中,我发现道具是从父母传给孩子的。而且状态只能在单个组件中使用。 ...