Is there any way to store the result in a variable and export it to another page? I can get the data from the SQLite DB, but the page exports the null variable before the selection has been done. I think it works in an async fashion.
I can’t do that, please help
here is the code that I had tried…
import React, { useState } from "react";
import Constants from "expo-constants";
import * as SQLite from "expo-sqlite";
const db = SQLite.openDatabase("billingsystem.db");
let all_results = null;
db.transaction((tx) => {
tx.executeSql(
"SELECT id, full_name FROM customer_info WHERE status='active'",
[],
(_, { rows }) =>
enter code here
(all_results = rows._array)
);
}, null);
export default all_results;