Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can retrieve items from the database in Expo SQLite by using the SELECT statement along with the query method in the Expo SQLite API. Here's an example:

import * as SQLite from 'expo-sqlite';
const db = SQLite.openDatabase('mydb.db');

db.transaction(tx => {
  tx.executeSql(
    'SELECT * FROM items',
    [],
    (_, {rows}) => {
      // Handle returned rows here
      console.log(rows);
    }
  );
});

In this example, we're selecting all items from the "items" table in the database and then handling the returned rows in the callback function. The rows are accessed through the rows parameter in the callback. You can then do whatever you need with the rows, such as displaying them on the screen or storing them in state.