- commit
- dbb4ee1
- parent
- fdd40e9
- author
- Eric Bower
- date
- 2024-08-17 01:23:38 +0000 UTC
docs: copy
3 files changed,
+10,
-9
+1,
-1
1@@ -33,7 +33,7 @@ export const updateUser = api.post<{ id: string; name: string }>(
2 );
3
4 const store = createStore(initialState);
5-store.run(api.bootup);
6+store.run(api.register);
7
8 store.dispatch(fetchUsers());
9 // now accessible with useCache(fetchUsers)
+1,
-1
1@@ -243,7 +243,7 @@ export function counter(initialState?: number) {
2 const [schema, initialState] = createSchema({
3 counter: counter(100),
4 });
5-const store = configureStore(initialState);
6+const store = createStore(initialState);
7
8 store.run(function* () {
9 yield* schema.update([
+8,
-7
1@@ -35,12 +35,13 @@ when an action is dispatched.
2 With all of this in mind, `starfx` takes all the good parts of `redux` and
3 removes the need for reducers entirely. We still have a single state object that
4 contains everything from API data, UX, and a way to create memoized functions
5-(e.g. selectors). We maintain immutability (using `immer`) and also have a
6-middleware system to extend it.
7+(e.g. [selectors](/selectors)). We maintain immutability (using
8+[immer](https://github.com/immerjs/immer)) and also have a middleware system to
9+extend it.
10
11-Finally, we bring the utility of creating a schema (like `zod` or a traditional
12-database) to make it plainly obvious what the state shape looks like as well as
13-reusable utilities to make it easy to update and query state.
14+Finally, we bring the utility of creating a schema (like [zod](https://zod.dev)
15+or a traditional database) to make it plainly obvious what the state shape looks
16+like as well as reusable utilities to make it easy to update and query state.
17
18 This gets us closer to treating our store like a traditional database while
19 still being flexible for our needs on the FE.
20@@ -92,8 +93,8 @@ const fetchUsers = api.get<never, User[]>(
21 },
22 );
23
24-const store = configureStore(schema);
25-store.run(api.bootup);
26+const store = createStore(schema);
27+store.run(api.register);
28 store.dispatch(fetchUsers());
29 ```
30