Skip to content

Instantly share code, notes, and snippets.

View tannerlinsley's full-sized avatar

Tanner Linsley tannerlinsley

View GitHub Profile
import { State } from 'jumpsuit'
const reducer = State({
// Initial State
initial: { count: 0 },
// Actions
increment (state, payload) {
return { count: state.count + 1 }
},
decrement (state, payload) {
import { Effect, Actions } from 'jumpsuit'
Effect('asyncIncrement', (time = 1000) => {
setTimeout(() => Actions.increment(), time)
})
import { Hook, Actions } from 'jumpsuit'
Hook((action, getState) => {
// Never letting the counter equal 10!
if (getState().counter.count === 10) {
Math.random() > 0.5 ? Actions.increment() : Actions.decrement()
}
})
// Import Jumpsuit
import { Render, State, Effect, Hook, Actions, Component } from 'jumpsuit'
// Create a state with some actions
const CounterState = State({
// Initial State
initial: { count: 0 },
// Javascript
import { Render, Router, Route, Redirect, IndexRoute, IndexRedirect } from 'jumpsuit'
Render(state, (
<Router>
<Route path='/' component={Layout}>
<IndexRoute component={Teams} />
<Route path='me' component={Me} />
<Route path='workspaces' component={Workspaces} />
<Route path='invite' component={WorkspaceInvite} />
import { State } from 'jumpsuit'
import _ from 'lodash'
import {FormDefaultProps} from 'react-form'
const formState = State('react-form', {
initial: {},
set (state, form) {
return {
...state,
[form.id]: form
@tannerlinsley
tannerlinsley / react-chart-brainstorm.js
Created March 1, 2017 17:53
react-chart-brainstorm
Solutions
Modules
Components
Primitives
<Path />
<Arc />
<Arc />
Responsive (Take up 100% of parent all the time)
State => Visualization
@tannerlinsley
tannerlinsley / index.html
Last active October 13, 2020 13:34 — forked from d3noob/.block
Simple bar graph in v4
<!DOCTYPE html>
<meta charset="utf-8">
<style> /* set the CSS */
.bar { fill: steelblue; }
</style>
<body>
<!-- load the d3.js library -->
@tannerlinsley
tannerlinsley / RouteTransition.jsx
Last active April 12, 2019 18:55 — forked from maisano/RouteTransition.jsx
Using react-move with react-router
import React, { PropTypes } from 'react'
import { Transition } from 'react-move'
const RouteTransition = React.createClass({
propTypes: {
pathname: PropTypes.string.isRequired
},
render() {
return (
@tannerlinsley
tannerlinsley / .block
Created April 25, 2017 14:27 — forked from mbostock/.block
Bar Chart
license: gpl-3.0