Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
switch (state.page) {
case 'Index':
// Do some additional logic
break
case 'About':
// Do some additional logic
break
default:
break
}
},
},
}
export const useOvermind = createHook()
import * as actions from './actions'
import * as context from './context'
import * as state from './state'
const config = {
context,
actions,
state,
}
const app = new App(config)
export type Connect = TConnect
export const connect = createConnect(app)
type IApp = TApp
export default app
// ==== The following types are copied from overmind documentation ====
export type Action = TAction<
IApp,
Value,
ReturnValue
>
export type Mutate = TMutate
export type Context = TContext
state.jsCode = prettier.format(transformedCode, state.prettier)
},
async submitForm({ state }) {
const svgoCode = await svgo(state.svgCode.trim())
const code = await svgr(svgoCode, state, {
componentName: state.name
})
state.jsCode = prettier.format(code, state.prettier)
}
},
effects: {
persistedState
}
}
export const useOvermind = createHook()
effects,
},
namespaced({
foo: {
actions: {
foo: () => {},
},
},
})
)
declare module 'overmind' {
interface Config extends IConfig {}
}
export const useOvermind = createHook()
},
addTodo({ value: event, state }) {
event.preventDefault()
state.todos.unshift({
title: state.newTodoTitle,
completed: false,
})
state.newTodoTitle = ''
},
toggleCompleted({ value: todo }) {
todo.completed = !todo.completed
},
},
})
export const useOvermind = createHook(app)
export default app
export interface Action<input>
extends IAction {}
export interface AsyncAction<input>
extends IAction> {}
export interface Operator<input>
extends IOperator {}
export interface Derive
extends IDerive {}
export const connect = createConnect();
export const useOvermind = createHook();
import * as effects from './effects'
import onInitialize from './onInitialize'
import state from './state'
export const config = {
onInitialize,
effects,
actions,
state,
}
declare module 'overmind' {
interface Config extends IConfig {}
}
export const useOvermind = createHook()
import { createOvermind } from 'overmind';
import { createHook } from 'overmind-react';
import { initialState } from './state';
import * as actions from './actions';
import * as effects from './effects';
export const store = createOvermind({
state: initialState,
actions,
effects,
});
export const useStore = createHook();
export interface Action<input>
extends IAction {}
export interface AsyncAction<input>
extends IAction> {}
export interface Operator<input>
extends IOperator {}
export interface Derive
extends IDerive {}
export const connect = createConnect();
export const useOvermind = createHook();