javascript - Fulling updating setState in reactjs -
in reactjs
docs setstate
:
setstate() not mutate this.state creates pending state transition. accessing this.state after calling method can potentially return existing value.
the second (optional) parameter callback function executed once setstate completed , component re-rendered.
what if wanted update state, create callback nothing?
the callback optional can this.setstate({ key: value });
.
Comments
Post a Comment