refactor: improve types by functional setState and remove react/no-unused-state

This commit is contained in:
lonyele 2019-07-02 19:11:50 +09:00
parent ca48248715
commit c7690c6af7

View File

@ -126,7 +126,6 @@ class Item extends Component<ItemProps, ItemState> {
failed: false,
payload: null,
payloadString: '',
// eslint-disable-next-line react/no-unused-state,
prevPayload: null,
};
@ -142,7 +141,7 @@ class Item extends Component<ItemProps, ItemState> {
newState.failed = true;
}
this.setState(newState as ItemState);
this.setState(state => ({ ...state, ...newState }));
};
onEmitClick = () => {