Coder Social home page Coder Social logo

Comments (5)

edunomatseye avatar edunomatseye commented on June 16, 2024 2

Maybe not a good idea to pass an async value directly or either through a function into state as this behaviour is synchronous. this could result to state inconsistency and also concurrency issues. looking at the delayed function passed into state.

from react.

eps1lon avatar eps1lon commented on June 16, 2024

Does this reproduce in dev and prod?

from react.

alexeyraspopov avatar alexeyraspopov commented on June 16, 2024

@eps1lon I made production build via npx vite build and the behavior remains the same.

from react.

nakjun12 avatar nakjun12 commented on June 16, 2024

Resolving the useTransition Hook Issue: Following Official Documentation

In my opinion, the issue mentioned above is not an actual issue according to the official React documentation. I resolved the problem using the following method:

Solution:

I moved the useTransition hook to the top level of the component, which resolved the error. (https://react.dev/reference/react/useTransition)

Reason:

The official documentation states: "Call useTransition at the top level of your component to mark some state updates as Transitions."

Conclusion:

When using the useTransition hook, it is essential to declare it at the top level of the component.

from react.

eps1lon avatar eps1lon commented on June 16, 2024

I moved the useTransition hook to the top level of the component, which resolved the error.

@nakjun12 Can you provide a repro or diff illustrating what you did? From what I can tell, the original repro is valid.

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.