- commit
- 34f382e
- parent
- 1b0365a
- author
- Eric Bower
- date
- 2023-12-19 14:11:29 +0000 UTC
docs: readme
1 files changed,
+7,
-1
+7,
-1
1@@ -180,7 +180,13 @@ const { db, initialState, update } = createSchema({
2 users: slice.table<User>(),
3 cache: slice.table(),
4 loaders: slice.loader(),
5+ // -- more slice examples --
6+ // token: slice.str(),
7+ // nav: slice.obj<{ collapsed: boolean }>(),
8+ // counter: slice.num(0),
9+ // userIds: slice.any<string[]>(),
10 });
11+type AppState = typeof initialState;
12
13 // just a normal endpoint
14 const fetchUsers = api.get<never, User[]>(
15@@ -202,7 +208,7 @@ const fetchUsers = api.get<never, User[]>(
16 }, {});
17
18 // update the store and trigger a re-render in react
19- yield* schema.update(db.users.add(users));
20+ yield* update(db.users.add(users));
21
22 // User[]
23 const users = yield* select(db.users.selectTableAsList);