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.

baobab-react with react-router >=1.0

See original GitHub issue

rooting-our-top-level-componen describes how to root a top level component.

ReactDom.render(
    require('baobab-react/higher-order').root(tree, App), 
    elem
)

With react-router >= 1.0, top level components are rendered however similar to this

ReactDom.render(
    <Router history={appHistory}>...</Router>,
    elem
)

What is the suggested pattern to use react-baobab with react-router >=1.0?

Applying the mixin pattern (mixins.root and mixins.branch) for rooting the baobab doesn’t seem to work with react-router >=1.0 either.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
Yomguitherealcommented, Aug 5, 2016

The current signature of the root function is root(tree, Component (code here). So it seems that the tree you provide is not a baobab tree. One thing you can also check is if you have the Baobab dep more than once in your deps because if the one used by the higher order function is not the same as the one from which you got your tree, it might cause issues.

0reactions
Yomguitherealcommented, Aug 15, 2016

I am happy it worked @hansman. It makes me think I should rollback to identity checking rather than checking the class instance in my tests for a Baobab tree. This would avoid this kind of problems.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Router 1.0.0 Uncaught Error: Invariant Violation
Following lines resolved my error var ReactDOM = require('react-dom'); var ReactRouter = require('react-router'); var Router = ReactRouter.
Read more >
React Router v5.1
Today, we are releasing React Router version 5.1. This post will discuss the 5.1 release as well as discuss a few things you...
Read more >
Keywords - react-router - npm
react-router. TypeScript icon, indicating that this package has built-in type declarations. 1.0.3 • Public • Published 7 years ago.
Read more >
Flux Architecture: Routing with react-router 1.0 | egghead.io
In this lesson we'll introduce routing into our application using react-router 1.0.
Read more >
React Router: Home v6.6.1
I'm New. Start with the tutorial. It will quickly introduce you to the primary features of React Router: from configuring routes, to loading...
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