Skip to content

Instantly share code, notes, and snippets.

@MatthewDavidCampbell
MatthewDavidCampbell / Mocha JSX compiler
Last active August 29, 2015 14:20
React, Mocha, JSDom with Reflux
var fs = require('fs');
var ReactTools = require("react-tools");
require.extensions['.jsx'] = function (module, filename) {
var content;
content = fs.readFileSync(filename, 'utf8');
var compiled = ReactTools.transform(content, { harmony: true });
return module._compile(compiled, filename);
};
@gaearon
gaearon / createAsyncPage.jsx
Last active April 25, 2023 09:06
Webpack's async code splitting with React Router
'use strict';
var React = require('react');
function createAsyncHandler(getHandlerAsync, displayName) {
var Handler = null;
return React.createClass({
displayName: displayName,
(function() {
// Do not use this library. This is just a fun example to prove a
// point.
var Bloop = window.Bloop = {};
var mountId = 0;
function newMountId() {
return mountId++;
}