Giter Club home page Giter Club logo

Comments (5)

mweststrate avatar mweststrate commented on July 16, 2024 6

No, just testing / reading sources / reverse engineering. It is just that setState, schedules, where forceUpdate executes. Sinces MobX already schedules, it is the better fit that avoids doing similar administration twice and avoids triggering unrelated lifecycle hooks. I hope that clarifies!

from mobx-react.

andykog avatar andykog commented on July 16, 2024 1

@arahansen, this.setState({}) would indeed result in rerendering, but then there is no guarantee, that it happens synchronously, so that mobx is able to derive reactive values, used during rendering.

from mobx-react.

mweststrate avatar mweststrate commented on July 16, 2024 1

indeed, forceUpdate is used internally, but it is behind MobX own scheduling mechanism, which is even more optimal then Reacts own setState mechanism. So as a component developer you shouldn't use it, but it is a perfect low level primitive where libs like mobx-react can build upon

from mobx-react.

arahansen avatar arahansen commented on July 16, 2024

Interesting, I was not aware of this!

Do you have any related studies or information on how forceUpdate is a preferred primitive for building libraries?

from mobx-react.

arahansen avatar arahansen commented on July 16, 2024

Yes, thanks for the explanation!

from mobx-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.