This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var universe = require('universe'); | |
var _ = require('lodash') | |
var myUniverse = null; | |
var queryRes = null; | |
var data = [ | |
{ | |
animal: 'cat', | |
value: 3, | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Jumpstate from 'jumpstate' | |
export default Jumpstate({ | |
// Initial State | |
initial: { | |
count: 0 | |
}, | |
// Actions | |
increment (state) { | |
return { count: ++state.count } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CounterState from './counterState' | |
CounterState.increment() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Jumpstate from 'jumpstate' | |
export default Jumpstate({ | |
actionCreator: true | |
}, { | |
// Initial State | |
initial: { | |
count: 0 | |
}, | |
// Actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import CounterState from './counterState' | |
const incrementAction = CounterState.increment() | |
dispatch(incrementAction) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Jumpstate from 'jumpstate' | |
export const CounterState = Jumpstate({ | |
// Initial State | |
initial: { | |
count: 0 | |
}, | |
// Actions | |
increment (state) { | |
return { count: ++state.count } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)) |
OlderNewer