Skip to content

Hot reload not working for stateless components #13

Description

@pulse00

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?

Activity

  1. geowarin commented on Jan 8, 2016

    @geowarin
    Owner

    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

  2. changed the title [-]Hot reload not working for connectec components[/-] [+]Hot reload not working for stateless components[/+] on Jan 8, 2016
  3. pulse00 commented on Jan 8, 2016

    @pulse00
    ContributorAuthor

    I see, thanks for pointing to this issue.

  4. gaearon commented on Apr 18, 2016

    @gaearon

    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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions