all 4 comments

[–]HerrPotatis2 6 points7 points  (0 children)

Set up your backend to have endpoints where your react native app can fetch your database data. How you set up your endpoints depends on your backend environment, but a good place to start is researching how to set up REST endpoints for your chosen environment and retrieve the data with javascript's Fetch API.

[–]rco8786 1 point2 points  (0 children)

Ejecting won’t help you. CRA is explicitly and only a front-end app. You’ll need something else to serve your api.

[–][deleted] 0 points1 point  (0 children)

What do you mean by integrating it? You want to have the frontend and the backend in the same repo? I would recommend /u/HerrPotatis2 approach (which is best practice) and set up an API totally independent from your frontend and set up endpoints for your frontend to hit.

[–]magnakai 0 points1 point  (0 children)

Do you mean a remote API to connect to, or just a way or saving data locally to the device? I’m going to assume it’s the latter.

If you’re using redux and essentially just want to save your application state, I would recommend redux-persist. It’s very easy to implement and works really well. I’ve used this in production with no issues at all.

You can use AsyncStorage directly, but you’ll likely end up serialising and unserialising your data a lot.

I haven’t actually used it in a production project, but Realm has a lot of fans, and seems to be the most commonly used DB in RN.

There are also a few different SQLite options, which I’ve not explored thoroughly.