GithubHelp home page GithubHelp logo

Comments (3)

quiteeasy avatar quiteeasy commented on June 24, 2024 1

Actually, the differed value is not changing immediately. It is working as stated in the docs.

React will first attempt a re-render with the old value (so it will return the old value), and then try another re-render in background with the new value (so it will return the updated value).

In your example everything is working right as described in docs. There are not many operations happening in background in your example so after the first render with an old value the engine immediately performs another background re-render and after finishing the first render you see an old value and almost immediately a new deferred one as the next re-render happens.

You can have a look at my code sample. Please, open the console and pay attention to isStale, query, deferredQuery variables. When console shows isStale as true it means that the value of variable is being differed at the moment you can see values of each variable in console log at every moment of code execution.

from react.

github-actions avatar github-actions commented on June 24, 2024

This issue has been automatically marked as stale. If this issue is still affecting you, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!

from react.

eps1lon avatar eps1lon commented on June 24, 2024

@quiteeasy's answer is correct. We can commit immediately since nothing suspends with the deferredQuery value.

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.