altjs / router

Connect react-router to alt so you can have routes in flux
29 stars 3 forks source link

Getting invariant violation and warning(s) #4

Closed collinwu closed 9 years ago

collinwu commented 9 years ago

Not sure what else to try. I spent a decent amount of time seeing if I could debug on my side, but no luck. Getting an invariant violation and some warning(s). See image below. I've also pasted my router.jsx and dependencies. I have another repo/project that uses almost identical code with slightly older versions and works fine. Any ideas?

screen shot 2015-11-06 at 8 24 13 pm

My dependencies:

"alt": "^0.17.8",
"alt-router": "^1.2.0",
"history": "^1.13.0",
"react": "^0.14.2",
"react-dom": "^0.14.2",
"react-router": "^0.13.5",
"react-tap-event-plugin": "^0.2.1"

Here's where AltRouter is used:

import React from 'react';
import { Router, Route, IndexRoute } from 'react-router';
import AltRouter from 'alt-router';
import alt from './libs/alt';
import createBrowserHistory from 'history/lib/createBrowserHistory';

import App from './components/app/App.jsx';

const history = createBrowserHistory();

const routes = (
  <Route path="/" component={App}>
  </Route>
)

export default class AppRouter extends React.Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <AltRouter flux={alt} history={history} routes={routes} />
    );
  }
}

export default AppRouter;
taion commented 9 years ago

You need one of the 1.0.0 prereleases of React Router, not v0.13.5.

@goatslacker Would it make sense to set up a peer dependency here?

collinwu commented 9 years ago

switched over to "react-router": "^1.0.0-rc3" and it works now! Cheers!

thanks @taion !

should I leave this issue open in case @goatslacker goatslacker wants to comment?

goatslacker commented 9 years ago

Yeah peer dependency is fine.