如何使用 Jest 測試 React 組件
4 回答

狐的傳說
TA貢獻1804條經驗 獲得超3個贊
可以在子組件添加一個componentWillRecieveProps周期,在里面獲取到即將接收的props。如下:componentWillReceiveProps(nextProps){this.setState({A:nextProps.A});}
添加回答
舉報
0/150
提交
取消