Skip to content

Instantly share code, notes, and snippets.

@adamterlson
adamterlson / flowbindings.js
Created January 22, 2019 07:42
Custom flowbindings for React-Redux
/* @flow */
import * as React from 'react'
import type { ComponentType, ElementConfig } from 'react'
declare type Action = { type: string }
declare type Dispatch = (arg: Action | Array<Action>) => mixed
declare type MapStateToProps<S, OP, SP> = (state: S, ownProps: OP) => SP
declare type MapDispatchToProps<OP, DP> = (dispatch: Dispatch, ownProps: OP) => DP
declare type MergeProps<SP, DP, OP, MP> = (stateProps: SP, dispatchProps: DP, ownProps: OP) => MP
@adamterlson
adamterlson / machine.js
Created April 21, 2020 19:05
Generated by XState Viz: https://xstate.js.org/viz
const transactionMachine = Machine({
id: 'transaction',
initial: 'draft',
states: {
draft: {
on: {
AUTHORIZE_PAYMENT: {
target: 'authorizing',
},
ADD_ITEM: {