Comments (18)
I'd like to. Any ideas how to tell class A is still class A in next version of module? Ideally we'd also like to support dynamically generated classes inside function. I can't think of a way to do that now..
from react-hot-loader.
We can probably differentiate by call index (first createClass in module, second, etc) and disable hot reload for createClass calls after module definition (this will avoid problems with functions). Would you like to try?
from react-hot-loader.
I didn't read through all code yet, is it possible to simply check for an id property and create it if necessary?
from react-hot-loader.
Ah, I see now, your use case is createClass
inside a function. Same as #24.
React does not support setting displayName property directly into wrapped component
Um, you're sure? I thought it worked.. Is it true for 0.11? So you can't do
return React.createClass({
displayName: displayName,
?
That's weird...
from react-hot-loader.
That's right, this problem is actual for 0.11. Same issue with Om: omcljs/om#124
from react-hot-loader.
OK, looking into that.
from react-hot-loader.
Why does this work for me?
http://jsbin.com/jaxezekeni/1/edit?html,js,output
/** @jsx React.DOM */
var wrap = function (displayName) {
return React.createClass({
displayName: displayName,
render: function () {
return <div>{displayName}</div>;
}
});
};
var A = wrap('yo');
var B = wrap('dawg');
var X = React.createClass({
render: function () {
return <div><A /><br /><B /></div>;
}
});
React.renderComponent(<X />, document.body);
from react-hot-loader.
Maybe the problem is with transferPropsTo
?
from react-hot-loader.
Your code works for me too. (Fixed fiddle to use displayName
)
from react-hot-loader.
It's very strange. I'll investigate it more precisely.
from react-hot-loader.
Are you sure you have 0.11 locally?
Maybe you updated package.json but old dependency is still there.
Om comment is from February so it may not be relevant anymore..
from react-hot-loader.
Figured it out. React was loaded twice in a bundle. Thank you for help. I'm closing this issue.
from react-hot-loader.
Woah, that's quite a common problem actually. I wish React warned right away when this happens!
from react-hot-loader.
I'm having an issue with React being loaded twice, but I don't understand what's causing it to be loaded twice. Do you guys have any tips? I'm using the google-map-react
library and this code:
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
Somehow seems to be loading an additional copy of react. Not even different versions! Why would Webpack ever load two copies of the same exact library? Seems like a bug to me
from react-hot-loader.
@jedwards1211 Those are not two Reacts, it's just the way Babel names variables.
from react-hot-loader.
@gaearon yes, I understood those aren't two Reacts. I think what was happening though was a second version of React was being loaded from google-map-react
's own node_modules
, even though its webpack bundle declares react as an external. I still haven't had time to get to the bottom of this issue
from react-hot-loader.
@jedwards1211 NPM doesn't care what Webpack says. If google-map-react
's version of React declared as peerDependency
is not compatible with the one in the outer project, NPM will install its own version of React inside there. That's the big problem with NPM 2, and it will be fixed in NPM 3.
from react-hot-loader.
Huh, it was compatible as far as I know, but that's good to know anyway. Thanks!
from react-hot-loader.
Related Issues (20)
- React.useEffect's callback will be called when the page is updated HOT 2
- Hot reloading tested in different ways and is not working properly HOT 1
- Sometimes hot() is needed not only for the root component HOT 2
- Hot-Reload fails with “Unexpected token '['. Expected opening '{' at the start of a class body.” HOT 1
- Warning: The final argument passed to useEffect changed size between renders.
- Could not resolve dependency HOT 12
- Not working with react-router-config: Uncaught ReferenceError: module is not defined HOT 9
- Reload Full Page instead of Refresh? HOT 1
- Attempted import error: 'AppContainer' is not exported from 'react-hot-loader'. HOT 1
- document click listener function executed twice: before and AFTER component rendered. HOT 4
- when props include "this"
- How to deal with multiple entries
- in sub project cannot replace in time
- React-hot-loader compatibility with React 16.14.0 HOT 1
- React 18 upgrade HOT 5
- Yarn 3 PNP not compatible
- Regular Expression Denial of Service (ReDoS) HOT 3
- hmr no work in React.PureComponent HOT 2
- Analysis: 98% of dependency updates in this repository can be merged.
- React-Hot-Loader: misconfiguration detected, using production version in non-production environment.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-hot-loader.