生命周期getDerivedStateFromProps的使用
2019-06-13 本文已影响0人
笑笑料料
static getDerivedStateFromProps(nextProps, state) {
if (nextProps.category !== state.category) {
return {
category: nextProps.category,
value: nextProps.options[0]
}
}
return null;
}