Skip to content

Commit 83d15eb

Browse files
authored
updated react native quick start (#98)
1 parent 790dcf9 commit 83d15eb

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

sqlite-cloud/quick-start-react-native.mdx

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@ cd sqlc-quickstart
2626
eas init --id {id}
2727
```
2828

29-
3. **Install the SQLite Cloud JS SDK**
29+
3. **Install the SQLite Cloud JS SDK and peer dependencies**
3030

3131
```bash
32-
npm install @sqlitecloud/drivers
32+
npm install @sqlitecloud/drivers react-native-tcp-socket react-native-fast-base64
3333
```
3434

3535
4. **Query data**
@@ -46,13 +46,14 @@ export default function App() {
4646

4747
useEffect(() => {
4848
async function getAlbums() {
49-
const db = new Database({
50-
connectionstring: '<your-connection-string>',
51-
usewebsocket: true,
52-
});
49+
const db = new Database('<your-connection-string>');
5350

5451
const result =
55-
await db.sql`USE DATABASE chinook.sqlite; SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist FROM albums INNER JOIN artists WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`;
52+
await db.sql`USE DATABASE chinook.sqlite;
53+
SELECT albums.AlbumId as id, albums.Title as title, artists.name as artist
54+
FROM albums
55+
INNER JOIN artists
56+
WHERE artists.ArtistId = albums.ArtistId LIMIT 20;`;
5657

5758
setAlbums(result);
5859
}
@@ -93,13 +94,14 @@ const styles = StyleSheet.create({
9394

9495
5. **Run your app**
9596

97+
Expo run iOS
9698
```bash
97-
npm start
99+
npx expo prebuild && npx expo run:ios
98100
```
99101

100-
- To see your app:
101-
- On iOS, use the Camera app to scan the QR code.
102-
- On Android, download and use the Expo Go app to scan the QR code.
103-
- On web, visit the localhost link.
102+
Expo run Android
103+
```bash
104+
npx expo prebuild && npx expo run:android
105+
```
104106

105107
And that's it! You've successfully built a React Native app that reads data from a SQLite Cloud database.

0 commit comments

Comments
 (0)