Permalink
Browse files

update examples

  • Loading branch information...
bubkoo committed Sep 6, 2017
1 parent 0a0a1d1 commit 475a141fbd6a800ec951347a262ef93de684bc45
@@ -3,7 +3,7 @@
"description": "Counter example work with ImmutableJS for mickey",
"dependencies": {
"immutable": "^3.8.1",
"mickey": "^0.2.2",
"mickey": "^0.2.4",
"react": "^15.6.1",
"redux-immutablejs": "^0.0.8"
},
@@ -1,22 +1,22 @@
/* eslint-disable react/prop-types */
import React from 'react'
import { actions, connect } from 'mickey'
import { connect, injectActions } from 'mickey'
import './App.css'
const App = props => (
<div id="counter-app">
<h1>{props.count}</h1>
<div className="btn-wrap">
<button onClick={() => actions.counter.decrement()}>-</button>
<button onClick={() => actions.counter.increment()}>+</button>
<button onClick={() => props.actions.counter.decrement()}>-</button>
<button onClick={() => props.actions.counter.increment()}>+</button>
<button
style={{ width: 100 }}
onClick={() => {
if (props.loading) {
alert('loading') // eslint-disable-line
} else {
actions.counter.incrementAsync()
props.actions.counter.incrementAsync()
}
}}
>
@@ -26,7 +26,9 @@ const App = props => (
</div>
)
export default connect((store) => {
console.log('data:', store.get('counter').toJS()) // eslint-disable-line
return ({ ...store.get('counter').toJS() })
})(App)
export default injectActions(
connect((store) => {
console.log('data:', store.get('counter').toJS()) // eslint-disable-line
return ({ ...store.get('counter').toJS() })
})(App),
)
@@ -3,7 +3,7 @@
"description": "Counter example work with persist and immutable for mickey",
"dependencies": {
"immutable": "^3.8.1",
"mickey": "^0.2.2",
"mickey": "^0.2.4",
"react": "^15.6.1",
"redux-action-buffer": "^1.1.0",
"redux-immutablejs": "^0.0.8",
@@ -1,22 +1,22 @@
/* eslint-disable react/prop-types */
import React from 'react'
import { actions, connect } from 'mickey'
import { injectActions, connect } from 'mickey'
import './App.css'
const App = props => (
<div id="counter-app">
<h1>{props.count}</h1>
<div className="btn-wrap">
<button onClick={() => actions.counter.decrement()}>-</button>
<button onClick={() => actions.counter.increment()}>+</button>
<button onClick={() => props.actions.counter.decrement()}>-</button>
<button onClick={() => props.actions.counter.increment()}>+</button>
<button
style={{ width: 100 }}
onClick={() => {
if (props.loading) {
alert('loading') // eslint-disable-line
} else {
actions.counter.incrementAsync()
props.actions.counter.incrementAsync()
}
}}
>
@@ -27,7 +27,9 @@ const App = props => (
</div>
)
export default connect((store) => {
console.log('data:', store.get('counter').toJS()) // eslint-disable-line
return ({ ...store.get('counter').toJS() })
})(App)
export default injectActions(
connect((store) => {
console.log('data:', store.get('counter').toJS()) // eslint-disable-line
return ({ ...store.get('counter').toJS() })
})(App),
)
@@ -2,7 +2,7 @@
"name": "counter-persist",
"description": "Counter example work with redux-persist for mickey",
"dependencies": {
"mickey": "^0.2.2",
"mickey": "^0.2.4",
"react": "^15.6.1",
"redux-action-buffer": "^1.1.0",
"redux-persist": "^4.9.1"
@@ -1,22 +1,22 @@
/* eslint-disable react/prop-types */
import React from 'react'
import { actions, connect } from 'mickey'
import { connect, injectActions } from 'mickey'
import './App.css'
const App = props => (
<div id="counter-app">
<h1>{props.count}</h1>
<div className="btn-wrap">
<button onClick={() => actions.counter.decrement()}>-</button>
<button onClick={() => actions.counter.increment()}>+</button>
<button onClick={() => props.actions.counter.decrement()}>-</button>
<button onClick={() => props.actions.counter.increment()}>+</button>
<button
style={{ width: 100 }}
onClick={() => {
if (props.loading) {
alert('loading') // eslint-disable-line
} else {
actions.counter.incrementAsync()
props.actions.counter.incrementAsync()
}
}}
>
@@ -27,4 +27,6 @@ const App = props => (
</div>
)
export default connect(store => ({ ...store.counter }))(App)
export default injectActions(
connect(store => ({ ...store.counter }))(App),
)
@@ -2,7 +2,7 @@
"name": "counter-undo",
"description": "Counter example work with redux-undo for mickey",
"dependencies": {
"mickey": "^0.2.2",
"mickey": "^0.2.4",
"react": "^15.6.1",
"redux-undo": "^1.0.0-beta9-9-6"
},
@@ -1,23 +1,23 @@
/* eslint-disable react/prop-types */
import React from 'react'
import { actions, connect } from 'mickey'
import { injectActions, connect } from 'mickey'
import { ActionCreators } from 'redux-undo'
import './App.css'
const App = props => (
<div id="counter-app">
<h1>{props.count}</h1>
<div className="btn-wrap">
<button onClick={() => actions.counter.decrement()}>-</button>
<button onClick={() => actions.counter.increment()}>+</button>
<button onClick={() => props.actions.counter.decrement()}>-</button>
<button onClick={() => props.actions.counter.increment()}>+</button>
<button
style={{ width: 100 }}
onClick={() => {
if (props.loading) {
alert('loading') // eslint-disable-line
} else {
actions.counter.incrementAsync()
props.actions.counter.incrementAsync()
}
}}
>
@@ -29,7 +29,9 @@ const App = props => (
</div>
)
export default connect((store) => {
console.log('data:', store.counter)
return { ...store.counter.present }
})(App)
export default injectActions(
connect((store) => {
console.log('data:', store.counter)
return { ...store.counter.present }
})(App),
)
@@ -2,7 +2,7 @@
"name": "counter",
"description": "Counter example for mickey",
"dependencies": {
"mickey": "^0.2.2",
"mickey": "^0.2.4",
"react": "^15.6.1"
},
"devDependencies": {
@@ -1,22 +1,22 @@
/* eslint-disable react/prop-types */
import React from 'react'
import { actions, connect } from 'mickey'
import { connect, injectActions } from 'mickey'
import './App.css'
const App = props => (
<div id="counter-app">
<h1>{props.count}</h1>
<div className="btn-wrap">
<button onClick={() => actions.counter.decrement()}>-</button>
<button onClick={() => actions.counter.increment()}>+</button>
<button onClick={() => props.actions.counter.decrement()}>-</button>
<button onClick={() => props.actions.counter.increment()}>+</button>
<button
style={{ width: 100 }}
onClick={() => {
if (props.loading) {
alert('loading') // eslint-disable-line
} else {
actions.counter.incrementAsync()
props.actions.counter.incrementAsync()
}
}}
>
@@ -26,4 +26,4 @@ const App = props => (
</div>
)
export default connect(store => ({ ...store.counter }))(App)
export default injectActions(connect(store => ({ ...store.counter }))(App))

0 comments on commit 475a141

Please sign in to comment.