You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: project-template/README.md
+77-4Lines changed: 77 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,10 +5,6 @@ To run this example:
5
5
-`npm install` or `yarn` or `pnpm install` or `bun install`
6
6
-`npm start` or `yarn start` or `pnpm start` or `bun run dev`
7
7
8
-
## Styling
9
-
10
-
This project includes [Tailwind CSS](https://tailwindcss.com/), a utility-first CSS framework.
11
-
12
8
## Routing
13
9
14
10
This project uses [TanStack Router](https://tanstack.com/router). The initial setup is a code based router. Which means that the routes are defined in code (in the src/main.tsx file). If you like you can also use a file based routing setup by following the [File Based Routing](https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing) guide.
@@ -360,3 +356,80 @@ export default App;
360
356
```
361
357
362
358
You can find out everything you need to know on how to use React-Query in the [React-Query documentation](https://tanstack.com/query/latest/docs/framework/react/overview).
359
+
360
+
## State Management
361
+
362
+
Another common requirement for React applications is state management. There are many options for state management in React. TanStack Store provides a great starting point for your project.
363
+
364
+
First you need to add TanStack Store as a dependency:
365
+
366
+
```bash
367
+
npm install @tanstack/store
368
+
```
369
+
370
+
Now let's create a simple counter in the `src/App.tsx` file as a demonstration.
One of the many nice features of TanStack Store is the ability to derive state from other state. That derived state will update when the base state updates.
394
+
395
+
Let's check this out by doubling the count using derived state.
We use the `Derived` class to create a new store that is derived from another store. The `Derived` class has a `mount` method that will start the derived store updating.
428
+
429
+
Once we've created the derived store we can use it in the `App` component just like we would any other store using the `useStore` hook.
430
+
431
+
You can find out everything you need to know on how to use TanStack Store in the [TanStack Store documentation](https://tanstack.com/store/latest).
432
+
433
+
# Learn More
434
+
435
+
You can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).
0 commit comments