@instantdb/react 0.22.57 → 0.22.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,15 +28,22 @@ Welcome to [Instant's](http://instantdb.com) React SDK.
28
28
  // * Updates instantly
29
29
  // * Multiplayer
30
30
  // * Works offline
31
+
32
+ import { init, id } from '@instantdb/react';
33
+
34
+ const db = init({
35
+ appId: process.env.NEXT_PUBLIC_APP_ID,
36
+ });
37
+
31
38
  function Chat() {
32
39
  // 1. Read
33
- const { isLoading, error, data } = useQuery({
40
+ const { isLoading, error, data } = db.useQuery({
34
41
  messages: {},
35
42
  });
36
43
 
37
44
  // 2. Write
38
45
  const addMessage = (message) => {
39
- transact(tx.messages[id()].update(message));
46
+ db.transact(db.tx.messages[id()].update(message));
40
47
  };
41
48
 
42
49
  // 3. Render!