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

Stateless functional components couldn't be hot updated #76

Closed
mewben opened this issue Dec 10, 2015 · 4 comments
Closed

Stateless functional components couldn't be hot updated #76

mewben opened this issue Dec 10, 2015 · 4 comments

Comments

@mewben
Copy link

mewben commented Dec 10, 2015

In index.js I changed line 3 to:

import App  from './App';

then in App.js I changed it to become a stateless functional component like this:

import React from 'react';

const App = () => (
  <div>App</div>
);

export default App;

There's no problem in the first run. But when I changed something in App.js, it doesn't hot reload. The browser console throws this error:

[HMR] The following modules couldn't be hot updated: (Full reload needed)
[HMR]  - ./src/App.js
@mewben
Copy link
Author

mewben commented Dec 10, 2015

@minooo Doesn't work.

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).
Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined.

@hbin
Copy link

hbin commented Dec 10, 2015

@jamiebuilds
Copy link
Collaborator

Yeah, follow the existing issue over on gaearon/babel-plugin-react-transform#57

@gaearon
Copy link
Owner

gaearon commented Apr 18, 2016

React Hot Loader 3 supports functional components without destroying the state.
Check it out: gaearon/react-hot-boilerplate#61

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

4 participants