如何使用 Jest 測(cè)試 React 組件
4 回答

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