Example

Import the createAppState function into your Javascript main file:

main.js

import { createAppState } from 'https://cdn.skypack.dev/ficusjs@6'

Create a new store instance with initialState and action functions:

main.js

const store = createAppState('an.example.store', {
  initialState: {
    count: 0
  },
  increment (payload) {
    this.state.count = this.state.count + payload
  }
})