Skip to content

Instantly share code, notes, and snippets.

@mxstbr
Created March 1, 2016 07:54
Show Gist options
  • Save mxstbr/970c84b39dd534816a73 to your computer and use it in GitHub Desktop.
Save mxstbr/970c84b39dd534816a73 to your computer and use it in GitHub Desktop.
esnextbin sketch
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>ESNextbin Sketch</title>
<!-- put additional styles and scripts here -->
</head>
<body>
<!-- put markup and other contents here -->
</body>
</html>
// write ES2015 code and import modules from npm
// and then press "Execute" to run your program
import React from 'react';
import ReactDOMServer from 'react-dom/server';
import { bindActionCreators } from 'redux';
function dispatch(func) {
return func;
}
var actions = {
firstAction: function firstAction() {
console.log('firstAction');
return function fakeThunk() {
console.log('firstAction thunk');
actions.secondAction();
}
},
secondAction: function secondAction() {
console.log('secondAction');
}
}
const boundActions = bindActionCreators(actions, dispatch);
boundActions.firstAction()(); // <-- need to call the thunk manually
{
"name": "esnextbin-sketch",
"version": "0.0.0",
"dependencies": {
"redux": "3.3.1",
"react-dom": "0.14.7",
"react": "0.14.7"
}
}
'use strict';
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _server = require('react-dom/server');
var _server2 = _interopRequireDefault(_server);
var _redux = require('redux');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function dispatch(func) {
return func;
} // write ES2015 code and import modules from npm
// and then press "Execute" to run your program
var actions = {
firstAction: function firstAction() {
console.log('firstAction');
return function fakeThunk() {
console.log('firstAction thunk');
actions.secondAction();
};
},
secondAction: function secondAction() {
console.log('secondAction');
}
};
var boundActions = (0, _redux.bindActionCreators)(actions, dispatch);
boundActions.firstAction()(); // <-- need to call the thunk manually
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment