-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Hot Module Reloading not working with functional components #277
Comments
Thanks for sharing, good to know why my About Page wasn’t reloading. On 13 Dec 2015, at 04:46, Nam Nguyen notifications@github.com wrote:
|
@mtsr @ntgn81 see discussion on #279 for explanation and discussion TL;DR: react-transform does not support functional components... this is known, documented and deliberate due to limitations with react itself (this issue can be closed) @davezuko i kinda assumed HMR for functional components wouldn't be an expectation since react-transform-hmr never supported it. might be be a good idea to add a note to docs about this? |
@justingreenberg My vote is that we just make everything extend |
@davezuko Sounds good. Are there any optimizations for production in place yet? For example the one mentioned with #279. |
they are still considered pure components as long as they only have a render method. @patrickheeney i have a working branch using i haven't opened a pr yet because i'm using a local i dug a little deeper and it looks like referentially transparent components in between root and edge nodes are no longer an issue since the rewrite of react-transform... transforms are not applied to function components but the plugin continue to traverse it's children. this means that the Root component must be component class, however something structural such as the CoreLayout component could be a function component (since it doesn't "need" HMR) and transforms still work on HomeView. This is essentially what I did in #292, with a explanation |
@justingreenberg Awesome work. I'd love to get that at some point, even if it might not make it into the starter kit because of the complexity. |
Hot Module Reloading is not yet working with functional components, according to gaearon/babel-plugin-react-transform#57
Took me some time to get to that link. Just putting this out here in case someone else has the same issue with
AboutView
not hot reloading.Looks like until it's fixed, it might be better to not use functional components. HMR gives me so much more than functional components at this point.
Also, this is a great starter kit. Exactly what I wanted without all the universal fuzz, making it so much harder to learn. Thank you for the great work! 🌟
The text was updated successfully, but these errors were encountered: