React guide article

Totally. Add redux to the equation with its built in connect() container and it’s even more confusing. Do I wrap the meteor data container with another container so I can connect to the redux store at the parent level, or do I wrap the connect component with the meteor data component? I’m trying to keep presentation containers separate from logic and it seems like I need multiple wrapper containers but I’m not sure what the right way to do it is.

2 Likes

Completely agree. Definitely need better documentation/examples surrounding createContainer.

2 Likes

The example code for using createContainer:
export default FooContainer = createContainer(() => {

… doesn’t pass the recommended Airbnb eslint style guide. I get “FooContainer is not defined. (no-undef)”.

I’m either missing something very simple, or else perhaps some info given in this article about the React Router is out of date? When I follow the example code given here, and import and use browserHistory, I get a barf of errors in the console that begins with:

"Warning: Failed prop type: The prop history is marked as required in Router, but its value is undefined.
in Router

I am importing as shown in this tutorial (I literally copy/pasted it into my code):
import { Router, Route, browserHistory } from 'react-router';

And I am referencing it when declaring the router, as shown in the example:
<Router history={ browserHistory }>

I also noticed that my editor, Webstorm, flags browserHistory in the import statement like so: “Cannet resolve symbol ‘browserHistory’.”

So did I screw something up? Or is there just a newer way to do this…?

Yeah React Router 4 came out recently and this article is likely not up to date!

import createBrowserHistory from 'history/createBrowserHistory'
const history = createBrowserHistory()
..
<Router history={history}> ...</Router>

You can see how I use it in this context… https://github.com/trajano/reactjs-admin/blob/master/src/components/Module.jsx

Note this is a frequently updated source at the moment which is why I haven’t put any line numbers info.

Is anyone else having issues using React Router v4 alongside the withTracker() Meteor method? My Routes stop working altogether if I export my component using withTracker(), but if I remove it, it works as expected. Should I look into using the Flow Router instead?

1 Like

I’m having the same issue.

I actually got it to work by using the react-komposer npm package rather than the baked in withTracker() method, although I’m not sure if it’s the best solution.

I ended up following this: https://stackoverflow.com/questions/46923697/upgrading-from-createcontainer-to-withtracker-with-react-router-v4

I’m seeing that react-mounter is not compatible with React 16.0.0. Looks like both react-mounter and flow-router are no longer being developed. Does anyone have any suggestions? I’m looking into migrating to react-router instead since it seems maintained.

1 Like