Skip to content

Commit

Permalink
Merge pull request #287 from gaearon/fix-create-factory
Browse files Browse the repository at this point in the history
patch createFactory
  • Loading branch information
gaearon committed May 5, 2016
2 parents a7191b5 + ad50110 commit 0e110e7
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/patch.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,18 @@ function patchedCreateElement(type, ...args) {
}
patchedCreateElement.isPatchedByReactHotLoader = true;

function patchedCreateFactory(type) {
// Patch React.createFactory to use patched createElement
// because the original implementation uses the internal,
// unpatched ReactElement.createElement
const factory = patchedCreateElement.bind(null, type);
factory.type = type;
return factory;
}
patchedCreateFactory.isPatchedByReactHotLoader = true;

if (typeof global.__REACT_HOT_LOADER__ === 'undefined') {
React.createElement = patchedCreateElement;
React.createFactory = patchedCreateFactory;
global.__REACT_HOT_LOADER__ = hooks;
}

0 comments on commit 0e110e7

Please sign in to comment.