How to make a model for array? #2240
-
I guess the answer should be something trivial, as MobX has observable arrays and maps. Say we have a Details I'm making a sandbox project with the PetStore API. I declared a model for the For example, speaking swr: const { data } = useSWR('list', () => api.pet.findPetsByStatus({ status: ['available'] }))
const pets = data?.data Now pets should be of the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
You probably want the array type: https://mobx-state-tree.js.org/API/#array |
Beta Was this translation helpful? Give feedback.
Ok, so just to see if we're on the same page. Is this the kind of logic you want to implement? And if so, is it missing something that you need?
Or have I still misunderstood what you're trying to do?
See in CodeSandbox