question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Usage with react-router

See original GitHub issue

I’m curious as to the preferred usage with react-router or if a different routing approach is more favorable with baobab.

If I run 0.4.x I can get baobab setup easily using the mixin included with the tree:

//...
var state = require('../state');

module.exports = React.createClass({
  mixins: [state.mixin],

  cursors: {
    users: ['models', 'users']
  },
  //...

When upgrading to 1.0.x I’m unable to get things working with the provided docs. I realize that 1.0.x was just released so I’m not sure if getting this working with react-router has been figured out yet.

Is there an idiomatic way to use baobab-react with react-router?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:30 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
manuelmazzuolacommented, Oct 12, 2015

I’ve resolved with

const createBaobabComponent = (Component, props) => {
  return <Component {...props} tree={tree} />
};


React.render(
  <Router createElement={createBaobabComponent}>
    <Route path="/" component={Layout}>
    </Route>
  </Router>
  , document.getElementById('content')
);
0reactions
philmdaycommented, Oct 12, 2015

@manuelmazzuola you are a beautiful person, thank you so! 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Quick Start - React Router: Declarative Routing for React.js
You can install React Router from the public npm registry with either npm or yarn . Since we're building a web app, we'll...
Read more >
React Router - W3Schools
The Layout component has <Outlet> and <Link> elements. The <Outlet> renders the current route selected. <Link> is used to set the URL and...
Read more >
ReactJS | Router - GeeksforGeeks
React Router is a standard library for routing in React. It enables the navigation among views of various components in a React Application, ......
Read more >
A Brief Overview of React Router and Client-Side Routing
Why use React Router? ... React Router, and dynamic, client-side routing, allows us to build a single-page web application with navigation without ...
Read more >
React Router DOM: How to handle routing in web apps
Because React Router DOM is only for apps that run in a web browser, it is not an appropriate package to use in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found