You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That's why the this.props.refreshList() call is needed. I have never used this.setState(this.state); before. That's needed because we are mutating state behind React's back.
I realize that, to do this properly with a setState, might seem complex to show students. We'd either have to use an immutable library, or make a deep copy. I suppose I'd recommend the latter for now, perhaps using lodash's cloneDeep?
The text was updated successfully, but these errors were encountered:
Mutating React state directly is a no-no. We are doing that with the lines in
EmployeeEditor.js
:That's why the
this.props.refreshList()
call is needed. I have never usedthis.setState(this.state);
before. That's needed because we are mutating state behind React's back.I realize that, to do this properly with a
setState
, might seem complex to show students. We'd either have to use an immutable library, or make a deep copy. I suppose I'd recommend the latter for now, perhaps using lodash'scloneDeep
?The text was updated successfully, but these errors were encountered: