Skip to content
This repository has been archived by the owner on Apr 9, 2020. It is now read-only.

Class properties do not hot reload ? #51

Closed
Elyx0 opened this issue Jan 13, 2016 · 3 comments
Closed

Class properties do not hot reload ? #51

Elyx0 opened this issue Jan 13, 2016 · 3 comments

Comments

@Elyx0
Copy link

Elyx0 commented Jan 13, 2016

In the context of a export default class Random extends React.Component {

With

    render() {
      return(
        {this.renderTest()}
        {this.renderTest3()}
     );
   }
    renderTest()
    {
      return <Button>I will hot reload</Button>;
    }

Works for hot reloading but

    renderTest3 = () => {
      return <Button>I will fail.</Button>;
    };

Will never get hot reloaded when changing the string. Is it a desired behavior ?

We get the [React Transform HMR] Patching Builder process-update.js?e13e:75 [HMR] Updated modules: process-update.js?e13e:77 [HMR] - ./app/components/Random.jsx process-update.js?e13e:82 [HMR] App is up to date.

And the corresponding webpackHotUpdate gets fetched, but the page stays the same.

.babelrc plugins:

"presets": ["stage-0","react", "es2015"],
  "plugins": [
    "syntax-class-properties",
    "syntax-decorators",
    "syntax-object-rest-spread",
    "transform-class-properties",
    "transform-decorators-legacy",
    "transform-object-rest-spread",
  ]

versions:

    "babel-plugin-react-transform": "^2.0.0",
    "babel-plugin-transform-class-properties": "^6.3.13",
    "babel-plugin-transform-decorators": "^6.3.13",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-es2015-classes": "^6.3.15",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.3.16",
    "babel-plugin-transform-object-rest-spread": "^6.3.13",

Could it be because it's a stage0 feature according to https://github.com/jeffmo/es-class-fields-and-static-properties ?

@gaearon
Copy link
Owner

gaearon commented Jan 13, 2016

Please see gaearon/react-proxy#8 (comment).

@gaearon gaearon closed this as completed Jan 13, 2016
@gaearon
Copy link
Owner

gaearon commented Jan 13, 2016

Technically we can make this work if there is enough interest and the spec stays the same. Let's wait a few more months and see.

@Elyx0
Copy link
Author

Elyx0 commented Jan 13, 2016

Thanks for your input, I will follow it closely 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants