x-view-model v2.2.1
x-view-model
binding view and view-model
Introduction
x-view-model
is a solution that make react hooks support MVVM without introduce any third-party libriries and aims to separates UI from business logic and provide immutable data & global state management, memory management and persistent data management and provide intuitive API.
Using x-view-model
will bring a lot of convenience as follows:
- πΌ Provide global and local state management, without introducing reducer or redux and other state management solutions;
- π² Provide global cache and persistent data storage management;
- π© It can make the business code more organized, maintainable and testable, and the division of responsibilities is clearer.
- π° Effectively avoid the problem of too many states that need to be managed inside the component, and simplify the useState and setState writing methods in the form of objects.
- π· There is no need to care about hooks inside the class-based ViewModel, so you can focus more on business logic development.
- π It can realize global data update and cross-component data transfer without
useReducer
or context - π² Different stores are divided according to the key, the view component will not respond to the state changes of the unused stores, and the performance overhead can be canceled
- π³ ViewModel will provide basic lifecycle functions, which is more convenient than useEffect to handle asynchronous functions
- π ViewModel will automatically trigger memory recycling according to the life cycle of react hooks, and memory management is more efficient
- π₯ No need to use
useCallback
to deal with component re-rendering problems caused by avoiding function reference changes. - π° After calling the updater to update, the latest state value can be obtained synchronously
- π It can realize fine-grained update of the attribute value of the object, and can realize immutable data
Document
Furture Feature
- API κ³ λν
- λ¬Έμ κ³ λν
- ViewFlow or ViewModel ν μ€νΈ κΈ°λ₯
16 days ago
22 days ago
22 days ago
22 days ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
10 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago