Mobx: Is there any costs for calling observable on already observed value?

Created on 24 Apr 2020  ยท  3Comments  ยท  Source: mobxjs/mobx

let obj1 = observable({bla: true});
let obj2 = observable(obj1);

will it introduce any performance issue or is it safe to do it?
will changes to obj2 trigger only one render?

โ” question

Most helpful comment

I believe this answers your question ;)

https://github.com/mobxjs/mobx/blob/326eae873af8c675202c4f47ed7d86b1e6107b4a/src/v5/api/observable.ts#L87

Sometimes quick peek into lib source code is faster than asking somewhere ;)

All 3 comments

I believe this answers your question ;)

https://github.com/mobxjs/mobx/blob/326eae873af8c675202c4f47ed7d86b1e6107b4a/src/v5/api/observable.ts#L87

Sometimes quick peek into lib source code is faster than asking somewhere ;)

thanks. you are right, didn't thought it will be so straightforward:) Thanks!

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs or questions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bb picture bb  ยท  3Comments

rodryquintero picture rodryquintero  ยท  3Comments

jamiewinder picture jamiewinder  ยท  4Comments

kirhim picture kirhim  ยท  3Comments

josvos picture josvos  ยท  3Comments