Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Console log actual variables from MobX store, not Proxy obejcts

Variables fetched from MobX store become Proxy objects in the console.

How can we log the actual variable?

like image 301
remidej Avatar asked Aug 29 '18 16:08

remidej


People also ask

Why is console log not formatting my object properly?

This happens because console.log is an asynchronous function and the object is only formatted later in time. This means that if you follow the title in the debugging toolbar, you can find the updated value.

How does mobx decide what to react to?

At that point it is invaluable to understand how MobX determines what to react to. MobX reacts to any existing observable property that is read during the execution of a tracked function.

Does mobx 5+ require proxies?

Yes, MobX 5+ does require proxies. Version 5 was the big proxy-based rewrite. If you need to use MobX in an environment that doesn't support proxies, you need to stick with MobX 4 (as I do, relatively painlessly).

What's the difference between mobx 4 and mobx version 5?

Version 5 was the big proxy-based rewrite. If you need to use MobX in an environment that doesn't support proxies, you need to stick with MobX 4 (as I do, relatively painlessly). Sorry, something went wrong. Facing the same error can anyone tell me how to resolve this one?


1 Answers

Im using object destructuring.

Mobx docs.

Example:

console.log({ ...StoreName.objectYouWantToLog });
like image 77
Raz Avatar answered Oct 17 '22 09:10

Raz