Accessing Referenced Data #287
Replies: 1 comment 3 replies
-
|
Hi there, reference access are made explicit on purpose (kind of like useRef in react), this is, so the user has a clear notion that he's using a reference with all its pros an cons (e.g., that it will be valid only as long as the source (referenced node) is still there, etc). For example, due to the accessor magic, in the case of MST, if you want to know if a reference is still valid you need to do a weird construct like: because in the case the original selectedTodo no longer exists, then just doing in mobx-keystone you can do |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi There,
I'm looking at
mobx-keystoneandmobx-state-treeas options for a normalized global store for a react app.In
mobx-state-treethey give an example here where a normalized reference can be accessed in a denormalized manner:With
mobx-keystoneI noticed that using acustomRefyou accessed the referenced item via the.currentproperty of the ref. So as I understand it, if I build something similar to the above example withmobx-keystoneto get the equivalent output I would instead have:However is there a way to access it the same way was you would in MST (accessing it and letting
mobx-keystonedo some magic and replace the reference with the actual object)?Beta Was this translation helpful? Give feedback.
All reactions