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

Does react-transform-hmr support pure function components #6

@dlmanning

Description

@dlmanning

I'm not having any luck getting components defined as a pure function to hot-reload. The component in question:

export default function Light (props) {
  const { light, toggleLight, id } = props
  const status = light.state.on ? 'one' : 'off'

  return (
    <div>{light.name}
      <button onClick={() => toggleLight({ ...light, id })}>
        {status}
      </button>
    </div>
  )
}

I get this error in the console:

[HMR] Updated modules:
(index):25734 [HMR]  - ./app/components/light.js
(index):25734 [HMR]  - ./app/components/lights.js
(index):25739 [HMR] App is up to date.
(index):15049 Uncaught TypeError: Cannot read property '__reactAutoBindMap' of null

Is this scenario supposed to work? Any idea what I'm doing wrong? Let me know if more context is needed.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions