OK, so about 4 hours later, I can’t seem to get the react router to work correctly, I have a shell app component that looks like this, basically all day I’ve tried to monkey around with this to get a basic shell app have a route as landing page, and terms, and privacy render different views. But I can’t seem to get this setup to work correctly. This is such a struggle, because there’s the es6 way and the meteor way and figuring out the nuances of the framework and the libraries really slows me down, especially when I just want to wrap my content… I’ll keep hacking at this in hopes somebody has solved a similar problem
I have a router that looks like this: (JSX code formatting not supported)
routes = Router
Route path="/" component={App}>
ndexRoute component={Landing}/>
Route path=“terms” component={Terms} />
Route path=“privacy” component={Terms} />
Route>
Router>
And I get errors like this:
should be a string (for DOM elements) or a ReactClass (for composite components).warning @ react-runtime-dev.js:1697
Uncaught TypeError: Cannot read property ‘defaultProps’ of undefined
How do people use any other data source in React Router? Presumably it’s through some sort of wrapper components? Seems like the Meteor thing should work fine, but I’ll admit it’s a bit hard to stay up to date with the ReactRouter API changes, which seem to be quite frequent.
You could also use Flow Router - personally I’m much more on board with the idea of the router as just another client-side store, rather than the thing in control of all app layout and data loading. React Router just seems to do too much under the hood for my taste.
Speaking of Redux and React Router, it’s nice that they have adopted the same convention of having “Page” components, just like we do for the Meteor Guide:
Hey thanks for that comment. By the way I am a new customer of Kadira. I’m falling back to Iron Router… since i can get my react views to work in blaze templates.
Sorry, it’s a waste of your time, but it’s very frustrating when I follow documentation very closely and don’t get things to work, especially since React is suppose to have great integration with Meteor. In some ways yes and in some ways no.
not quite sure it will help, but the way work with me in meteor 1.3 Alpha is not using the react from meteor(or you will have to use browserify like the doc) and i did the following
import React from ‘react’;
import ReactDOM from ‘react-dom’;
import { Provider } from ‘react-redux’;
const routeConfig = [
{ path: ‘/app’,
component: AppContainer,
childRoutes: [
RegisterRoute, //append child routes of each feature in here
LoginRoute
]
}
]
Cool. I just had the time to get to upgrade to Meteor 1.2 last week, so I’ll move to 1.3 as soon as it’s released. I can work around this for a bit. I really like the react router combined with the react component model.
Do you have a repo that could be cloned? I’m working on an app now that is using react router and it works great and I’m especially enjoying the fact that SSR is so effortless!