Skip to content

Commit

Permalink
patch createFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Campos committed May 4, 2016
1 parent a7191b5 commit fdad6ce
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/patch.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,17 @@ 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;
}

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

0 comments on commit fdad6ce

Please sign in to comment.