Releases: gaearon/react-hot-api
v0.5.0
React Hot API is deprecated!
This is the final release that delegates all processing to React Proxy. See 0.5.0-alpha release notes for migration instructions.
Generally, it's recommended that, instead of migrating to React Hot API 0.5.0, you just use React Proxy because React Hot API is now a thin wrapper around it, and won't be developed further.
v0.4.7
v0.5.0-alpha-3
- Fixes inheritance support (gaearon/react-hot-loader#184, gaearon/react-proxy#9, gaearon/react-proxy#19)
v0.5.0-alpha-2
- Fixes instance leak and rAF being undefined in server environment
v0.5.0-alpha
React Hot API is superseded by React Proxy. This is meant to be the last release of React Hot API, with the new source code just delegating to React Proxy API.
It is recommended you do not use React Hot API anymore, and migrate projects to use React Proxy directly. There may be some breakage, so please make sure to report it. Unlike React Hot API, React Proxy is fully covered tests. React Hot Loader will also migrate to use React Proxy soon.
Breaking Changes
- React 0.13 or later is now required.
- The signature changes from
(getRootInstances[, React]) => makeHot
to([getRootInstances,] React) => makeHot
. Note:getRootInstances
is only there to keep the old calls working, but we no longer need it, and you can safely stop passing it. Conversely,React
is now a required argument. Since we expect React 0.13, we expectReact.Component
to be available. - We no longer check whether the passed class has a prototype and a
render
function. It is up to you now to guarantee that whatever's passed is a valid React component class. When React supports pure functions as components (in 0.14), we'll add support for them to React Proxy. - We no longer overwrite or even touch the original class. Every time
makeHot
is invoked, it will return a special proxy class. This means a caveat: for example, with React Hot Loader, static methods will only be hot-reloaded if you refer to them asthis.constructor.doSomething()
instead ofFooBar.doSomething()
. This is because React Hot Loader callsmakeHot
right before exporting, soFooBar
still refers to the original class. Similarly,this.constructor === App
will befalse
insideApp
unless you callApp = makeHot(App)
manually, which you can't do with React Hot Loader. I'm not sure how much of a problem this will be, so let me know if it pains you. In the longer term, we will deprecate React Hot Loader in favor of a Babel plugin which will be able to rewrite class definitions correctly, so it shouldn't be a problem for a long time. If there is demand, we can introduce a mode that rewrites passed classes, too.
API Changes
- The goal of this release is to provide the new features of React Proxy to React Hot API consumers, so, apart from making
React
a required argument, and ignoringgetRootInstances
if it is passed, the API stays the same. - Nevertheless, if you depend on React Hot API, we suggest you to migrate to React Proxy.
Improvements and Bugfixes
- There is no requirement to pass
getRootInstances()
anymore, so React Hot Loader doesn't needreact/lib/ReactMount
or walk the tree, which was somewhat fragile and changing between versions - Static methods and properties are now hot-reloaded
- Instance getters and setters are now hot reloaded
- Static getters and setters are now hot reloaded
- Deleted instance methods are now deleted during hot reloading
- Single method form of autobind-decorator is now supported
Things that Aren't There
These things didn't make the cut:
- Error reporting (it is available in #23 but I don't want to support this project without tests so I'll move it)
- Preserving DOM and state of classes decorated with HOCs. (This will be solved later with Babel plugin.)
- Hot-reloading ES7 property syntax. (This will probably too be solved later with Babel plugin.)
Help Me Test This!
A React Hot Loader beta using this version will come out soon. Please help me test it! I'm sure there are many cases React Proxy doesn't handle yet, but at least we can write tests for them now.
v0.4.6
v0.4.5
v0.4.4
- Fix autobinding of new methods on old-style React classes (gaearon/react-hot-loader#123)