State

The state is the only essential part for a module.

const module = defineModule(state)

The typings of a state is inferred from the initial state object, but if you want to specify the type, you can declare it explicitly.

type State = { blogs: { title: string, createdAt: string, content: string }[] }
const module = defineModule<State>({ blogs: [] })

Last updated