Preventing re-rendering when accessing view with argument #1742
-
So essentially I have something similar to this
My component is accessing |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I've replicated this @NgoKnows: https://codesandbox.io/s/stupefied-brook-6h9df?file=/src/App.tsx My initial thought is that it might make sense to use a const AuthorBooks = types.model({
id: types.identifier
books: types.array(types.reference(Book))
})
// in BookStore
booksByAuthor: types.map(AuthorBooks) Then populate that property when you update your books. This is a little more manual than I'd like -- I wish your code worked out of the box -- but I don't think there's an easy way to do that. If anyone wants to take a stab at it, check out the sandbox and then share your findings here. |
Beta Was this translation helpful? Give feedback.
I've replicated this @NgoKnows:
https://codesandbox.io/s/stupefied-brook-6h9df?file=/src/App.tsx
My initial thought is that it might make sense to use a
types.map
for this; essentially, you'd make something like this:Then populate that property when you update your books.
This is a little more manual than I'd like -- I wish your code worked out of the box -- but I don't think there's an easy way to do that. If anyone wants to take a stab at it, check out the sandbox and then share your findings here.