Model

A model contains all types and plugins used in your application. To create a model, call createModel with State as a type parameter.

import { createModel } from "@prodo/core";
export interface State {
count: number;
}
export const model = createModel<State>();
export const { state, watch, dispatch } = model.ctx;

You can also extend the model with plugins. You add plugins to the model using the .with function.

import logger from "@prodo/logger";
// ...
export const model = createModel<State>().with(logger);