react-hot-loader
Advanced tools
Comparing version
16
hot.js
@@ -76,2 +76,16 @@ 'use strict'; | ||
function forceUpdateTree(instance) { | ||
if (instance.forceUpdate) { | ||
instance.forceUpdate(); | ||
} | ||
if (instance._renderedComponent) { | ||
forceUpdateTree(instance._renderedComponent); | ||
} | ||
for (var key in instance._renderedChildren) { | ||
forceUpdateTree(instance._renderedChildren[key]); | ||
} | ||
} | ||
var Component; | ||
@@ -89,3 +103,3 @@ return { | ||
instance._bindAutoBindMethods(); | ||
instance.forceUpdate(); | ||
forceUpdateTree(instance); | ||
}); | ||
@@ -92,0 +106,0 @@ |
{ | ||
"name": "react-hot-loader", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"description": "Webpack loader that enables live-editing React components without unmounting or losing their state", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
# react-hot-loader | ||
This is a **highly experimental** proof of concept of [React live code editing](http://www.youtube.com/watch?v=pw4fKkyPPg8). | ||
It marries React with Webpack [Hot Module Replacement](http://webpack.github.io/docs/hot-module-replacement.html) by monkeypatching `React.createClass`. | ||
It marries React with Webpack [Hot Module Replacement](http://webpack.github.io/docs/hot-module-replacement.html) by wrapping `React.createClass` calls in a custom function that updates components' prototypes when the changes come in. | ||
Inspired by [react-proxy-loader](https://github.com/webpack/react-proxy-loader). | ||
 | ||
 | ||
## Installation | ||
@@ -49,2 +54,3 @@ | ||
Currently, it keeps a list of mounted instances and updates their prototypes when an update comes in. | ||
A better approach may be to make monkeypatch `createClass` to return a proxy object [as suggested by Pete Hunt](https://github.com/webpack/webpack/issues/341#issuecomment-48372300): | ||
@@ -51,0 +57,0 @@ |
8487
7.04%195
5.98%62
10.71%