@loomup/react-native
v0.1.7
Published
React Native helpers for Loomup Realtime (AsyncStorage session + hooks)
Readme
@loomup/react-native
React Native helpers for Loomup, built on @loomup/client and @loomup/react.
npm install @loomup/client @loomup/react @loomup/react-native @react-native-async-storage/async-storageimport AsyncStorage from "@react-native-async-storage/async-storage";
import {
createNativeClient,
LoomupNativeProvider,
useAuth,
useLiveQuery,
} from "@loomup/react-native";
// Android emulator: 10.0.2.2 — iOS sim: 127.0.0.1 — device: LAN IP
const client = createNativeClient({ url: "http://10.0.2.2:3000" });
export function App() {
return (
<LoomupNativeProvider client={client} asyncStorage={AsyncStorage}>
<Todos />
</LoomupNativeProvider>
);
}
function Todos() {
const { user, signIn } = useAuth();
const { data } = useLiveQuery("todos", { strategy: "merge" });
// ...
}Full documentation: tryloomup.com/docs.
npm install
npm test
npm run build