How to use the overmind.Overmind function in overmind

To help you get started, we’ve selected a few overmind examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cerebral / overmind / packages / demos / react-todomvc / src / app / index.js View on Github external
import { Overmind } from 'overmind'
import { createHook } from 'overmind-react'

const app = new Overmind({
  state: {
    todos: [],
    newTodoTitle: '',
    count: (state) => state.todos.length,
  },
  actions: {
    changeNewTodoTitle({ value: event, state }) {
      state.newTodoTitle = event.target.value
    },
    addTodo({ value: event, state }) {
      event.preventDefault()
      state.todos.unshift({
        title: state.newTodoTitle,
        completed: false,
      })
      state.newTodoTitle = ''
github cerebral / overmind / packages / demos / vue-todomvc / src / app / index.js View on Github external
import { Overmind } from 'overmind'
import { createConnect } from 'overmind-vue'

const app = new Overmind({
  state: {
    todos: [],
    newTodoTitle: '',
    count: (state) => state.todos.length,
  },
  actions: {
    changeNewTodoTitle({ value: event, state }) {
      state.newTodoTitle = event.target.value
    },
    addTodo({ value: event, state }) {
      event.preventDefault()
      state.todos.unshift({
        id: String(Date.now()),
        title: state.newTodoTitle,
        completed: false,
      })