@orderofchaos/mvvm
v0.1.1
Published
Modern MVVM architecture for React + MobX. Best of class components — predictable lifecycle, state encapsulation, automatic cleanup — with functional components and hooks.
Maintainers
Readme
@orderofchaos/mvvm
Современная MVVM-архитектура для React + MobX.
Пакет подходит, если вам нужны:
- функциональные React-view
- явные lifecycle hooks у
ViewModel - автоматическая очистка реакций, таймеров и интервалов
- явная композиция дочерних компонентов через props
Установка
npm install @orderofchaos/mvvm mobx mobx-react reactМинимальное использование
import { makeObservable, observable } from "mobx";
import { ViewModel, view } from "@orderofchaos/mvvm";
class CounterViewModel extends ViewModel {
@observable count = 0;
constructor() {
super();
makeObservable(this);
}
}
export const CounterView = view(CounterViewModel)(
({ viewModel }) => <button type="button">{viewModel.count}</button>,
);Документация
- Docs index: https://order-of-chaos.github.io/mvvm/docs/
- Getting started: https://order-of-chaos.github.io/mvvm/docs/getting-started/
- API reference: https://order-of-chaos.github.io/mvvm/docs/api-reference/
- Examples: https://order-of-chaos.github.io/mvvm/docs/examples/
- Русская страница: https://order-of-chaos.github.io/mvvm/docs/ru/
Репозиторий
- GitHub: https://github.com/order-of-chaos/mvvm
- Примеры в репозитории: https://github.com/order-of-chaos/mvvm/tree/main/examples
- Процесс релиза: https://github.com/order-of-chaos/mvvm/blob/main/RELEASING.md
