Don’t use this for new projects.
React Proxy is much more advanced, has a better API, and is covered by tests.
You can read the README before deprecation if you want to.
(Deprecated) A generic library implementing hot reload for React components without unmounting or losing their state
Don’t use this for new projects.
React Proxy is much more advanced, has a better API, and is covered by tests.
You can read the README before deprecation if you want to.
It would be much easier now due to cleaner separation.
Here's what tests should do:
ComponentBeforeUpdate
, ComponentAfterUpdate
render
returns a different tree;setTimeout
also execute new code after update.Basically verify that patching works correctly. Edge cases to consider:
createClass
, extends React.Component
in 0.13+, plain object in 0.13+)shouldComponentUpdate
returning false
Sorry if this has been answered elsewhere (or if there's a good technical reason), but it seems that constructors in ES6 classes aren't hot-updated like the rest of the class is?
As far as I understand, NPM messes up when trying to depend both 0.14.0-beta1
and on libraries that has declared React as a peerDependency.
For example
"react": "0.14.0-beta1",
"react-date-picker": "2.0.15",
Does not work well because react-date-picker
has peerDependency >= 0.13.0
I've seen this commit which seems to be your solution to this problem (that I could validate on my computer for react-date-picker), so I simply add 0.14.0-beta1 to the list.
c11de6c
By the way, isn't there any better solution? Should I contact every lib author to make the change so that I'm able to use that beta? :'(
reference to gaearon/react-hot-loader#131
Autobinding should be skipped here
Should we change 0.14.0-beta1
to 0.14.0-beta3
?
"peerDependencies": {
"react": ">=0.11.0 || 0.13.0-beta.1 || 0.13.0-rc1 || 0.13.0-rc2 || 0.14.0-beta1"
},
Also 0.13.0-beta.1 || 0.13.0-rc1 || 0.13.0-rc2
can be safely removed now?
Autobinding changes in facebook/react#4612, we want to support this if it lands.
Currently statics are not being hot-replaced. We want to support that—both for traditional createClass
style and for ES6 classes.
It should probably do some more introspection using Object.getOwnPropertyDescriptor or some such.
If you have an inheritance chain with something like Babel, only the top level prototype is updated.
We should probably walk the prototype chain here: https://github.com/gaearon/react-hot-api/blob/master/modules/makePatchReactClass.js#L40.
This is up for grabs!
If I export a factory obtained with React.createFactory()
, hot loader currently crashes:
makePatchReactClass.js: Cannot read property 'render' of undefined
While exporting factories is a discouraged pattern, we should still avoid throwing.
(And ideally, support hot reloading for exported factories.)
Hi @gaearon,
I understand that react-hot-api is deprecated, but could you update the peerDependencies? Seems like everything works with React 15.0.0-rc.1, but I'm getting the peer invalid
error when I shrinkwrap my packages.
Calling makeHot
twice on the same component will cause a stack overflow.
For example:
App = makeHot(App, 'App');
App = makeHot(App, 'App');
This happens because we treat patched prototype as source of truth, but it has already been processed.
I meet a strange question and I can't find out the reason. This problem appear after I updated a npm package. Can someone give me some promote?
makeAssimilatePrototype.js:21 Uncaught TypeError: Cannot set property updatePosition of #<t> which has only a getter
at patchProperty (webpack:///./~/react-hot-api/modules/makeAssimilatePrototype.js?:21:16)
at eval (webpack:///./~/react-hot-api/modules/makeAssimilatePrototype.js?:52:9)
at Array.forEach (native)
at eval (webpack:///./~/react-hot-api/modules/makeAssimilatePrototype.js?:51:51)
at Array.forEach (native)
at reconcileWithStoredPrototypes (webpack:///./~/react-hot-api/modules/makeAssimilatePrototype.js?:50:21)
at assimilatePrototype (webpack:///./~/react-hot-api/modules/makeAssimilatePrototype.js?:63:5)
at patchReactClass (webpack:///./~/react-hot-api/modules/makePatchReactClass.js?:40:5)
at Object.makeHot (webpack:///./~/react-hot-api/modules/makeMakeHot.js?:33:12)
at makeExportsHot (webpack:///./~/react-hot-loader/makeExportsHot.js?:44:26)
My ENV
Thoughts on fallback to ReactUpdateQueue.enqueueForceUpdate
on react-0.13 components not created using React.createClass
and that don't extend React.Component
?
Here is an example using a patched loader and api that uses the fallback
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.