Skip to content

Instantly share code, notes, and snippets.

@rsxdalv
Created January 29, 2019 10:54
Show Gist options
  • Save rsxdalv/da7922cb0ebb64caf1bb66dd321dd634 to your computer and use it in GitHub Desktop.
Save rsxdalv/da7922cb0ebb64caf1bb66dd321dd634 to your computer and use it in GitHub Desktop.
import * as R from "ramda";
import { ActionTypes } from "../actions";
import { ReducerFunction, ReducerIdenity } from "./i-root-state";
export const toolReducer: Record<string, ReducerFunction> = {
[ActionTypes.SELECT_TOOL]: R.converge(R.assoc("tool"), [
R.path(["action", "value"]),
ReducerIdenity,
]),
[ActionTypes.DESELECT_TOOL]: R.converge(R.assoc("tool"), [
R.always(undefined),
ReducerIdenity,
]),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment