Giter Site home page Giter Site logo

Comments (5)

albertogasparin avatar albertogasparin commented on August 20, 2024 1

Marked as duplicated because it has the same root cause: the conversion to functional component. By going back to class and using getDerivedStateFromProps to trigger those state changes, the warning and the deoptimisation go away (could not reproduce anymore).
I assume because that static method is called before render phase and so mutating state is still a valid operation

from react-sweet-state.

albertogasparin avatar albertogasparin commented on August 20, 2024

Duplicated #219
We have a PR up #221 that however needs validation

from react-sweet-state.

yamadapc avatar yamadapc commented on August 20, 2024

Is it duplicated?

from react-sweet-state.

yamadapc avatar yamadapc commented on August 20, 2024

This isn't really a "change in behaviour caused by React 17 to 18", but it is a bug in React 16 where using the setState API in onUpdate will always trigger an error to be logged.

This is a problem because developers will be confused by the warnings being logged and not know that they are coming from React Sweet State.

This is still an issue with certain options after #221.

I suggest the setState parameter be removed from the update hook API on the cases it will break / print a warning.

from react-sweet-state.

albertogasparin avatar albertogasparin commented on August 20, 2024

While we work on #221 , a workaround is to set

defaults.batchUpdates = true

which is what we use across some products in production

from react-sweet-state.

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.