For the complete documentation index, see llms.txt. This page is also available as Markdown.

Svelte

There are two differente ways to connect Overmind to Svelte. You can use the reactive declarations or you can use the reaction.

When you connect Overmind to a component you ensure that whenever any tracked state changes, only components interested in that state will re-render.

Reactive declarations

import { createOvermind } from 'overmind'
import { createMixin } from 'overmind-svelte'

const overmind = {
  state: {
    count: 0
  },
  actions: {
    increase({ state }) {
      state.count++;
    },
    decrease({ state }) {
      state.count--;
    }
  }
}

const store = createMixin(createOvermind(overmind))

export const state = store.state
export const actions = store.actions

Reactions

Last updated