Update docs and sort content

This commit is contained in:
github-actions[bot]
2025-02-08 08:51:33 +00:00
parent 205430caa9
commit 28163ec726
6 changed files with 93 additions and 8 deletions

View File

@ -17,7 +17,7 @@ slug: share-my-incorrect-usage-case-of-zustand-en
description: Zustand is a state management library that is simple and easy to use. It allows you to access the state via a single selector or shallow comparison to prevent unnecessary re-renders of all components. When the state is updated, you can use `useShallow` to retrieve only the required data. Additionally, you should follow the principle of minimal granularity, only fetching the necessary data instead of using multiple stores to manage different states. Moreover, state that is unrelated to the UI does not need to be accessed via a selector. The correct approach is to directly access the store within the `handleSave` method.
toAstro: true
date_created: 2025-01-04T11:44:53+08:00
date_modified: 2025-02-07T11:45:53+08:00
date_modified: 2025-02-07T18:00:15+08:00
astroType: post
---
@ -115,11 +115,11 @@ const CurrentCamera: React.FC = () => {
In the official documentation [Flux-inspired practice - Zustand](https://zustand.docs.pmnd.rs/guides/flux-inspired-practice), it is mentioned that you should use a single store, not multiple stores for different states.
> **Recommended patterns**
>
>
> **Single store**
>
>
> Your application's global state should be located in a single Zustand store.
>
>
> If you have a large application, Zustand supports splitting the store into slices.
## Mistake 4: Accessing UI-unrelated state via selectors

View File

@ -17,7 +17,7 @@ description:
toAstro: true
astroType: "post"
date_created: 2025-01-14T17:31:35+08:00
date_modified: 2025-02-07T11:25:34+08:00
date_modified: 2025-02-08T11:47:21+08:00
---
when i use react-router and vite, i want to config my router in the router.config.ts file and also generate some config for the target path dir. (like the nextjs router which is automatically generated based on the file structure)
@ -176,4 +176,6 @@ function App() {
this is a simple way to generate the path like router config for the target path dir in the vite + react + react-router project.
if you want to see a demo, you can see the [demo repo](https://github.com/KazooTTT/vtkjs-react-demos).
if you want to know more about the `vite-plugin-pages` plugin, you can see the [github repo](https://github.com/hannoeru/vite-plugin-pages).