+ Clicked: {counter} times {' '} + {' '} + {' '} + +
+ ); + } +} + +Counter.propTypes = { + increment: PropTypes.func.isRequired, + autoIncrement: PropTypes.func.isRequired, + incrementAsync: PropTypes.func.isRequired, + decrement: PropTypes.func.isRequired, + counter: PropTypes.number.isRequired, +}; + +export default Counter; diff --git a/extension/examples/counter/containers/App.js b/extension/examples/counter/containers/App.js new file mode 100644 index 0000000000..47287ecfdf --- /dev/null +++ b/extension/examples/counter/containers/App.js @@ -0,0 +1,16 @@ +import { bindActionCreators } from 'redux'; +import { connect } from 'react-redux'; +import Counter from '../components/Counter'; +import * as CounterActions from '../actions/counter'; + +function mapStateToProps(state) { + return { + counter: state.counter, + }; +} + +function mapDispatchToProps(dispatch) { + return bindActionCreators(CounterActions, dispatch); +} + +export default connect(mapStateToProps, mapDispatchToProps)(Counter); diff --git a/extension/examples/counter/index.html b/extension/examples/counter/index.html new file mode 100644 index 0000000000..58c0aa80b9 --- /dev/null +++ b/extension/examples/counter/index.html @@ -0,0 +1,10 @@ + + + ++ Clicked: {counter} times {' '} + +
+ ); + } +} + +export default Counter; diff --git a/extension/examples/react-counter-messaging/index.html b/extension/examples/react-counter-messaging/index.html new file mode 100644 index 0000000000..352f8a0a9b --- /dev/null +++ b/extension/examples/react-counter-messaging/index.html @@ -0,0 +1,10 @@ + + + ++ Clicked: {value} times {' '} + {' '} + {' '} + +
+); + +Counter.propTypes = { + value: PropTypes.number.isRequired, + onIncrement: PropTypes.func.isRequired, + onDecrement: PropTypes.func.isRequired, + onIncrementAsync: PropTypes.func.isRequired, + onIncrementIfOdd: PropTypes.func.isRequired, +}; + +export default Counter; diff --git a/extension/examples/saga-counter/src/main.js b/extension/examples/saga-counter/src/main.js new file mode 100644 index 0000000000..83406bda48 --- /dev/null +++ b/extension/examples/saga-counter/src/main.js @@ -0,0 +1,43 @@ +import 'babel-polyfill'; + +import React from 'react'; +import ReactDOM from 'react-dom'; +import { createStore, applyMiddleware, compose } from 'redux'; +import createSagaMiddleware from 'redux-saga'; +// import sagaMonitor from './sagaMonitor' + +import Counter from './components/Counter'; +import reducer from './reducers'; +import rootSaga from './sagas'; + +const sagaMiddleware = createSagaMiddleware(/* {sagaMonitor} */); +const composeEnhancers = + (window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ && + window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({ + trace: true, + traceLimit: 25, + })) || + compose; +const store = createStore( + reducer, + composeEnhancers(applyMiddleware(sagaMiddleware)), +); +sagaMiddleware.run(rootSaga); + +const action = (type) => store.dispatch({ type }); + +function render() { + ReactDOM.render( +