made with esnextbin
Created
March 1, 2016 07:54
-
-
Save mxstbr/970c84b39dd534816a73 to your computer and use it in GitHub Desktop.
esnextbin sketch
This file contains hidden or 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
<!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> |
This file contains hidden or 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
// 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 |
This file contains hidden or 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
{ | |
"name": "esnextbin-sketch", | |
"version": "0.0.0", | |
"dependencies": { | |
"redux": "3.3.1", | |
"react-dom": "0.14.7", | |
"react": "0.14.7" | |
} | |
} |
This file contains hidden or 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
'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