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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -