# autostore **Repository Path**: akaedu2012/autostore ## Basic Information - **Project Name**: autostore - **Description**: 强大的React状态库,支持异步计算/信号组件/双向表单绑定/细粒度渲染,简洁易用的API等 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: https://zhangfisher.github.io/autostore/ - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2024-12-03 - **Last Updated**: 2024-12-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # AutoStore [](https://badge.fury.io/js/autostore) [Document](https://zhangfisher.github.io/autostore) Very easy and elegant state management library. It is based on proxy and provides functions such as signaling, computation, and watching to ensure fine-grained updates ## Features - **Reactive**: Implemented based on `Proxy`, automatically triggers view updates when data changes. - **In-place Computed**: Unique in-place computation feature allows declaring `computed` properties anywhere in the state tree, with results written in place. - **Automatic Dependency Tracking**: Automatically tracks dependencies of `computed` properties, only recalculates when dependencies change. - **Asynchronous Computation**: Powerful asynchronous computation control, supports advanced features like `timeout, retry, cancel, countdown, progress`. - **State watch**: Can listen to operations on state objects and arrays such as `get/set/delete/insert/update`. - **Signal Components**: Supports `signal` mechanism, enabling fine-grained component updates. - **DevTools**: Supports `Redux DevTools Extension` for `chrome`, making it easy to debug state changes. - **Nested State**: Supports arbitrarily deep nested states, eliminating concerns about the complexity of state management. - **Form Binding**: Powerful and simple two-way form binding, making data collection easy and fast. - **Circular Dependency**: Helps detect circular dependencies to reduce faults. - **TypeScript**: Fully supports TypeScript, providing complete type inference and hints. - **Unit Testing**: Provides comprehensive unit test coverage to ensure code quality. ## Install ```bash npm install @autostorejs/react yarn add @autostorejs/react pnpm add @autostorejs/react ``` ## Get-started - **Basic usage** ```ts import { createStore } from '@autostorejs/react'; const { $, state,useReactive } = createStore({ user: { firstName: 'zhang', lastName: 'fisher', fullName: (scope)=> { return scope.firstName + scope.lastName; } } }); // use in component const Card = () => { const [ firstName,setFirstName ] = useReactive('user.firstName'); const [ lastName,setLastName ] = useReactive('user.lastName'); return