![]() ![]() If the new value you provide is identical to the current state, as determined by an Object.is comparison, React will skip re-rendering the component and its children. If you read the state variable after calling the set function, you will still get the old value that was on the screen before your call. The set function only updates the state variable for the next render. Set functions do not have a return value. During the next render, React will calculate the next state by applying all of the queued updaters to the previous state. React will put your updater function in a queue and re-render your component. It must be pure, should take the pending state as its only argument, and should return the next state.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |