@interface-db/expo-sqlite
v1.0.67
Published
Expo SQLite interface for InterfaceDB
Readme
@interface-db/expo-sqlite
Expo SQLite interface for InterfaceDB.
Maintained by InterfaceDB, based on the Instant source. See LICENSE.md and NOTICE for attribution.
Welcome to Instant's Expo SQLite interface.
Usage
Create an app with expo
npx create-expo-app instant-rn-demo
cd instant-rn-demoInstall instant
npm i @interface-db/react-native @interface-db/expo-sqliteInstall peer dependencies
npx expo install expo-sqlite @react-native-community/netinfo react-native-get-random-values @react-native-async-storage/async-storageImport Storage from @interface-db/expo-sqlite
// ༼ つ ◕_◕ ༽つ Real-time Chat
// ----------------------------------
// * Updates instantly
// * Multiplayer
// * Works offline
import { init, id } from '@interface-db/react-native';
import SQLiteStore from '@interface-db/expo-sqlite';
const db = init({
appId: process.env.EXPO_PUBLIC_INSTANT_APP_ID,
Store: SQLiteStore,
});
function Chat() {
// 1. Read
const { isLoading, error, data } = db.useQuery({
messages: {},
});
// 2. Write
const addMessage = (message) => {
db.transact(db.tx.messages[id()].update(message));
};
// 3. Render!
return <UI data={data} onAdd={addMessage} />;
}Get Started
Follow the getting started tutorial to set up a live React Native app in under 5 minutes!
Questions?
If you have any questions, feel free to drop us a line on our issue tracker
