infernojs / create-inferno-app

Create Inferno apps with no build configuration.
MIT License
351 stars 34 forks source link

inferno-router props.children is Empty #60

Closed Khangeldy closed 11 months ago

Khangeldy commented 6 years ago

In development everything works correct. But when i deployed my app into github pages. I get error cause this.props.children is empty. See Open dev console output. What i am doing wrong?

Root.js

const routes = (
  <Router history={browserHistory}>
    <Route component={App}>
      <IndexRoute component={Home}/>
      <Route path="/about" component={About}/>
    </Route>
  </Router>
)

App.js

<div className="App-intro">
  { console.log(this.props, this.props.children)}
  { Inferno.cloneVNode(this.props.children, {diffMode: this.state.activateDiffMode}) }
</div>
LukeSheard commented 6 years ago

I think you might need to add the path="/" prop to your App Route component. What's the actual error that you're getting? and which version of Inferno do you have installed?

Khangeldy commented 6 years ago

Error is a chilren property. It is empty. In above code cloneVnode first parameter get null type. I think this problem related to github SPA pages. I solved error by changing browserHistory to hashHistory. And error only reproduced in github pages.

"dependencies": {
    "gh-pages": "^1.1.0",
    "inferno": "^3.10.1",
    "inferno-component": "^3.10.1",
    "inferno-router": "^3.10.1",
    "inferno-scripts": "5.0.0"
  },

screenshot from 2018-01-01 14-34-26

Havunen commented 11 months ago

Closing this old issue.