Skip to content

Instantly share code, notes, and snippets.

@tildedave
Created January 1, 2015 18:12
Show Gist options
  • Save tildedave/81f981558b3cd4f8d1bd to your computer and use it in GitHub Desktop.
Save tildedave/81f981558b3cd4f8d1bd to your computer and use it in GitHub Desktop.
dave@margaret:~/workspace/isomorphic-react-without-node/duktape-1.0.2$ ./duk init.js react-0.12.2.js test.js
<div data-reactid=".1n7svbvilrt" data-react-checksum="1140200483">This is my content</div>
// Forces React into node.js mode
var global = {};
function consoleShim() {
print(Array.prototype.join.call(arguments, ' '));
}
var console = {};
['debug', 'log', 'info', 'warn'].forEach(function(i) {
console[i] = consoleShim;
});
var React = global.React;
var A = React.createClass({
render: function() {
return React.DOM.div(null, 'This is my content');
}
});
console.log(React.renderToString(React.createElement(A)));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment