Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = ''
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,
})