mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 12:26:01 +00:00
12 lines
259 B
TypeScript
12 lines
259 B
TypeScript
import { writable } from 'svelte/store';
|
|
|
|
export default function createReducer(reducer, initialState): any {
|
|
const state = writable(initialState);
|
|
|
|
function dispatch(action) {
|
|
state.update(x => reducer(x, action));
|
|
}
|
|
|
|
return [state, dispatch];
|
|
}
|