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

Support React-Hot-Loader v3 #772

Closed
justin808 opened this issue Mar 25, 2017 · 7 comments
Closed

Support React-Hot-Loader v3 #772

justin808 opened this issue Mar 25, 2017 · 7 comments

Comments

@justin808
Copy link
Member

Looks like React on Rails should allow this:

https://github.com/gaearon/react-hot-loader/tree/master/docs#migration-to-30

When we call ReactDOM.render, we could automatically create the AppContainer if a preference for hot relading is set.

import React from 'react'
import ReactDOM from 'react-dom'
import { AppContainer } from 'react-hot-loader'
import App from './containers/App'

ReactDOM.render(
  <AppContainer>
    <App/>
  </AppContainer>,
  document.getElementById('root')
);

// Hot Module Replacement API
if (module.hot) {
  module.hot.accept('./containers/App', () => {
    const NextApp = require('./containers/App').default;
    ReactDOM.render(
      <AppContainer>
        <NextApp/>
      </AppContainer>,
      document.getElementById('root')
    );
  });
}

Anybody want to try this and submit a PR?

@justin808
Copy link
Member Author

@Judahmeek does the new hot loader require any changes to React on Rails?

@Judahmeek
Copy link
Contributor

Judahmeek commented Apr 4, 2017

No, it does not. React on Rails already supports hot reloading with RHL 3 (Example).

@justin808
Copy link
Member Author

@Judahmeek This looks more like a doc than a code issue.

@justin808
Copy link
Member Author

@LyzioOh
Copy link
Contributor

LyzioOh commented Jul 24, 2017

I go for it :-), i want easy hot module replacement on my project.

@justin808
Copy link
Member Author

justin808 commented Jul 24, 2017

@EEtancelin I've changed the tag on this one to mark it as owned by you. Please get back to me soon to let me know of the progress and any questions. Definitely reach out to @Judahmeek with any questions as well, maybe in our Slack room for ShakaCode.

@justin808
Copy link
Member Author

Supporting hot loader changes is out of scope for React on Rails currently.

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