2.0.14 • Published 10 months ago

@lofik/react v2.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

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-origin
  • Cross-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.

  • useLofikAccount
  • useLofikAccountActions
  • useLofikDatabase
  • useLofikMutation
  • useLofikQuery
  • useLofikQueryClient
2.0.14

10 months ago

2.0.13

10 months ago

2.0.12

10 months ago

2.0.11

10 months ago

2.0.10

10 months ago

2.0.9

10 months ago

2.0.8

10 months ago

2.0.7

10 months ago

2.0.6

10 months ago

2.0.5

11 months ago

2.0.4

11 months ago

2.0.3

11 months ago

2.0.2

11 months ago

2.0.1

11 months ago

2.0.0

11 months ago

1.0.24

11 months ago

1.0.23

11 months ago

1.0.22

11 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

12 months ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago