Skip to content

Support React-Hot-Loader v3 #772

Closed
Closed
@justin808

Description

@justin808

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions