Creating the Store
Explore how to create and set up a MobX store as the central source of truth in your React Native app. Learn to integrate MobX-State-Tree with React context, provide the store to your app using a Provider, and access state data within components. This lesson helps you manage state efficiently and prepare your app for scalable data handling.
We will start with setting up a store; this will be the source of truth for the app. But before adding and removing images, there’s one more step we need to take. We need to hook up the store!
Creating an empty store
Let’s go to our store.js file and tell it to use the User and LikedImages models. We’ll start by importing all the necessary files and creating an empty store:
We import the two models
ImportImagesandUseron lines ...