- Refine and expand best practices for: - AI SDK - Date-fns - Next.js - Radix UI - React - React Hook Form - Stripe - Tailwind CSS - TypeScript - Zustand - Improve guidelines with more specific and actionable recommendations - Enhance type safety and performance suggestions across different technologies
10 lines
418 B
Plaintext
10 lines
418 B
Plaintext
---
|
|
description: Best practices for state management with Zustand
|
|
globs: **/*.{ts,tsx}
|
|
alwaysApply: false
|
|
---
|
|
|
|
- Use the `create` function to define your store for simplicity and performance.
|
|
- Implement middleware like `persist` for persisting state across sessions.
|
|
- Utilize the `useStore` hook for accessing store state in components.
|
|
- Leverage the `immer` middleware for easier state updates with mutable syntax. |