GithubHelp home page GithubHelp logo

Comments (5)

capaj avatar capaj commented on July 27, 2024 1

@dmi3y I did it already, thanks so much!

from jspm-react.

capaj avatar capaj commented on July 27, 2024

yeah, this is something I started to get as well. Will definitely investigate when I have time.

from jspm-react.

fryck avatar fryck commented on July 27, 2024

+1 ...

from jspm-react.

grady-lad avatar grady-lad commented on July 27, 2024

I was coming across this today too, it seemed to not like forceUpdate() within the RenderForcer class.
I can still hot-reload by removing forceUpdate() but I still need this
class to perform hot reloads which has confused me more.


class RenderForcer extends Component {

  constructor() {
    super();
  }

  componentWillMount() {
    // this.forceUpdate();
  }

  render() {
    return (
      <Provider store={store}>
        <div>
        <Router history={createBrowserHistory()}>
          {getRoutes()}
        </Router>
        <DevTools/>
        </div>
      </Provider>
    );
  }
}

if (__DEVTOOLS__) {
  ReactDOM.render(
    <RenderForcer/>,
    document.getElementById('app')
  );
}

from jspm-react.

dmi3y avatar dmi3y commented on July 27, 2024

Based on this comment.

I did modify the app.js like so (moved Route from render Router into top level constant):

    import React from 'react'
    import ReactDOM from 'react-dom'
    import { browserHistory } from 'react-router'
    import { Router, Route } from 'react-router'

    import Home from './routes/home'
    import { IntlProvider, addLocaleData } from 'react-intl'
    import en from 'react-intl/locale-data/en'
    addLocaleData(en)

    const routes = <Route path='/' component={Home}/>

    class RenderForcer extends React.Component {
      constructor () {
        super()
      }
      componentWillMount () {
        this.forceUpdate()  // a little hack to help us rerender when this module is reloaded
      }
      render () {

        return <IntlProvider locale='en'>
          <Router history={browserHistory}>
            {routes}
          </Router>
        </IntlProvider>
      }
    }

    ReactDOM.render((
      <RenderForcer/>
    ), document.getElementById('app'))

Which made error (warning) goes away.

Also it seems makes sense to separate routes. Either way, if this is something that considered as improvement I can open MR.

from jspm-react.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.