2.0.14 • Published 2 years ago
@lofik/react v2.0.14
lofik react
To see lofik being used in a demo app, have a look at the examples
Basic usage
!IMPORTANT To make persistent storage (OPFS) work, these two headers are required
Cross-Origin-Opener-Policy: same-originCross-Origin-Embedder-Policy: require-corp
Use LofikProvider at the top of your app:
<LofikProvider
create={[
// updatedAt column is required to determine if database operation should be applied
`
CREATE TABLE IF NOT EXISTS todos (
id VARCHAR(40) PRIMARY KEY,
title TEXT NOT NULL,
pubKeyHex TEXT NOT NULL,
deletedAt INTEGER,
updatedAt INTEGER NOT NULL,
createdAt INTEGER NOT NULL
);
`,
]}
seed={[]} // array of sql queries
loader={<div>loading..</div>}
migrate={async (db) => {}}
websocketServerUrl="ws://localhost:8080"
>
{children}
</LofikProvider>Then make use of the following hooks. The library is written in typescript, autocomplete will help you a lot.
useLofikAccountuseLofikAccountActionsuseLofikDatabaseuseLofikMutationuseLofikQueryuseLofikQueryClient
2.0.14
2 years ago
2.0.13
2 years ago
2.0.12
2 years ago
2.0.11
2 years ago
2.0.10
2 years ago
2.0.9
2 years ago
2.0.8
2 years ago
2.0.7
2 years ago
2.0.6
2 years ago
2.0.5
2 years ago
2.0.4
2 years ago
2.0.3
2 years ago
2.0.2
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
1.0.24
2 years ago
1.0.23
2 years ago
1.0.22
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.17
2 years ago
1.0.16
2 years ago
1.0.15
2 years ago
1.0.14
2 years ago
1.0.13
2 years ago
1.0.12
2 years ago
1.0.11
2 years ago
1.0.10
2 years ago
1.0.9
2 years ago
1.0.8
2 years ago
1.0.7
2 years ago
1.0.6
2 years ago
1.0.5
2 years ago
1.0.4
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago