Skip to content

Instantly share code, notes, and snippets.

View tannerlinsley's full-sized avatar

Tanner Linsley tannerlinsley

View GitHub Profile
@tannerlinsley
tannerlinsley / index.js
Last active July 20, 2016 23:11
requirebin sketch
var universe = require('universe');
var _ = require('lodash')
var myUniverse = null;
var queryRes = null;
var data = [
{
animal: 'cat',
value: 3,
},
{
// Yep, that's all you have to import
import { Render, State, Component } from 'jumpsuit'
// Create a state and with some actions
const CounterState = State('counter', {
// Initial State
initial: { count: 0 },
// Actions
import Jumpstate from 'jumpstate'
export default Jumpstate({
// Initial State
initial: {
count: 0
},
// Actions
increment (state) {
return { count: ++state.count }
import CounterState from './counterState'
CounterState.increment()
import Jumpstate from 'jumpstate'
export default Jumpstate({
actionCreator: true
}, {
// Initial State
initial: {
count: 0
},
// Actions
import CounterState from './counterState'
const incrementAction = CounterState.increment()
dispatch(incrementAction)
import React from 'react'
import ReactDOM from 'react-dom'
import { Provider } from 'react-redux'
import { createStore, combineReducers } from 'redux'
import { attachDispatcher } from 'jumpstate'
//
import App from './App'
import CounterState from './state/counter'
import './index.css'
import React, { Component } from 'react'
import { connect } from 'react-redux'
//
import CounterState from './state/counter'
//
import logo from './logo.svg'
import './App.css'
class App extends Component {
render() {
import Jumpstate from 'jumpstate'
export const CounterState = Jumpstate({
// Initial State
initial: {
count: 0
},
// Actions
increment (state) {
return { count: ++state.count }
@tannerlinsley
tannerlinsley / async-actions-comparison.js
Last active November 6, 2016 00:26
Comparisons between redux-thunks, redux-sagas, and jumpsuit
// Thunk
import { loading, setAll, error, loading} from 'actions/posts'
export refreshPosts () {
return (dispatch) => {
dispatch(loading(true))
return Axios.get('posts')
.then((res) => {
dispatch(setAll(res.data))