Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reload not working for stateless components #13

Closed
pulse00 opened this issue Jan 7, 2016 · 3 comments
Closed

Hot reload not working for stateless components #13

pulse00 opened this issue Jan 7, 2016 · 3 comments

Comments

@pulse00
Copy link
Contributor

pulse00 commented Jan 7, 2016

Thanks for this repo, it helped a lot getting started with setting up spring and react!

Here's a question though: When running the frontend app using npm start, hot module replacement does not work when editing UI components:

process-update.js:59 [HMR] The following modules couldn't be hot updated: (Full reload needed)
 - ./src/ui/Component.js

Is this a known issue in this starter app?

@geowarin
Copy link
Owner

geowarin commented Jan 8, 2016

Yes, unfortunately, stateless functional components are not yet supported by the react transform plugin...
The workaround is to create good old components extending React.Component

Change this:

export const MyComponent = (props) => {
...
}

to this:

export class MyComponent extends React.Component {

  render() {
...
  }
}

See:
gaearon/babel-plugin-react-transform#57

This is unfortunate since functional component are really awesome

@geowarin geowarin changed the title Hot reload not working for connectec components Hot reload not working for stateless components Jan 8, 2016
@pulse00
Copy link
Contributor Author

pulse00 commented Jan 8, 2016

I see, thanks for pointing to this issue.

@pulse00 pulse00 closed this as completed Jan 8, 2016
@gaearon
Copy link

gaearon commented Apr 18, 2016

React Hot Loader 3 supports functional components without destroying the state.
It supersedes both React Hot Loader and React Transform, and is built on lessons learned from both.
Check it out: gaearon/react-hot-boilerplate#61

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

No branches or pull requests

3 participants