added comment about setting initial state

This commit is contained in:
Ben Wheeler 2019-10-17 23:34:31 -04:00
parent 16a1fccc27
commit 0dfd1cf9fc

View file

@ -36,6 +36,9 @@ class JoinFlow extends React.Component {
step: 0, step: 0,
waiting: false waiting: false
}; };
// it's ok to set state by reference, because state is treated as immutable,
// so any changes to its fields will result in a new state which does not
// reference its past fields
this.state = this.initialState; this.state = this.initialState;
} }
canTryAgain () { canTryAgain () {