前端应用状态管理 —— 状态提升

上一个评论功能的案例中,可能会有些同学会对一个地方感到疑惑: CommentList 中显示的评论列表数据为什么要通过父组件 CommentApp 用 props 传进来?为什么不直接存放在 CommentList 的 state 当中?例如这样做也是可以的: class CommentList extends Component { constructor () { this.sta
相关文章
相关标签/搜索