Coder Social home page Coder Social logo

Convert to simple object about mobx-react HOT 2 CLOSED

mobxjs avatar mobxjs commented on May 21, 2024
Convert to simple object

from mobx-react.

Comments (2)

mweststrate avatar mweststrate commented on May 21, 2024

Hi,

Mobservable doesn't convert non-plain objects automatically, as that is considered to be the responsibility of the (constructor of) the object, as making the object observable could potentially interfere with the inner workings of the object.

However, using mobservable.extendReactive you can simply add additional properties to an existing object, like mobservable.extendReactive(store.currentStyle, { width: 3 }), or even make all properties of the object observable at once by using mobservable.extendReactive(store.currentStyle, store.currentStyle).

from mobx-react.

mrjjwright avatar mrjjwright commented on May 21, 2024

Thanks so much, yeah I figured that out after a while. This all sounds
awesome, so glad I found this library.

On Sun, Oct 11, 2015 at 8:28 AM, Michel Weststrate <[email protected]

wrote:

Hi,

Mobservable doesn't convert non-plain objects automatically, as that is
considered to be the responsibility of the (constructor of) the object, as
making the object observable could potentially interfere with the inner
workings of the object.

However, using mobservable.extendReactive you can simply add additional
properties to an existing object, like mobservable.extendReactive(store.currentStyle,
{ width: 3 }), or even make all properties of the object observable at
once by using mobservable.extendReactive(store.currentStyle,
store.currentStyle).

โ€”
Reply to this email directly or view it on GitHub
#4 (comment)
.

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.