Comments (15)
๐ hi @amitkumarsingh . At first glance, you'd want to change...
const breadcrumbs = this.props;
to const { breadcrumbs } = this.props;
or const breadcrumbs = this.props.breadcrumbs
If that's not the issue, I'd have to see what's in scenarioManagerRoutes
to be able to assist.
from react-router-breadcrumbs-hoc.
from react-router-breadcrumbs-hoc.
If you try using the HOC without pre-defined routes does it work?
withBreadcrumbs()(ScenarioManagerHome)
The HOC will attempt generate breadcrumbs for you if no routes are provided. If this works we can rule a couple things out!
from react-router-breadcrumbs-hoc.
export const scenarioManagerRoutes = [
{ path: '/scenario/home', component: ScenarioManagerHome, exact: true , breadcrumb : 'Scenario'},
{ path: '/scenario/model/create', component: ScenarioModelComposer, exact: true , breadcrumb : 'Create Scenario'},
{ path: '/scenario/model/create/:id?', component: ScenarioModelComposer, exact: true , breadcrumb : 'Edit Scenario'},
{ path: '/scenario/model/details/:id?', component: ScenarioModelDetails, exact: true , breadcrumb : 'Scenario Details'},
from react-router-breadcrumbs-hoc.
If you try using the HOC without pre-defined routes does it work?
withBreadcrumbs()(ScenarioManagerHome)
The HOC will attempt generate breadcrumbs for you if no routes are provided.
Nope.
from react-router-breadcrumbs-hoc.
Is there something i am missing ? As per documentaion i have used it correctly ?
from react-router-breadcrumbs-hoc.
At first glance the code looks ok, but remotely debugging can be tricky sometimes... I can tell you this HOC has test coverage to ensure it works, but something about your codebase/setup/config etc may be affecting it.
Couple more things:
1.) which version of this component are you using? (2.3.1?)
2.) any errors in console?
3.) when running the HOC w/o route config withBreadcrumbs()(ScenarioManagerHome)
. What does console.log(this.props.breadcrumbs)
output?
4.) I assume withBreadcrumbs()(ScenarioManagerHome)
is being mounted somewhere? (not the connect
-wrapped version)
from react-router-breadcrumbs-hoc.
OH, also, which version of react-router
are you using?
from react-router-breadcrumbs-hoc.
1.) which version of this component are you using? (2.3.1?) YES
2.) any errors in console? NO
3.) when running the HOC w/o route config withBreadcrumbs()(ScenarioManagerHome). What does console.log(this.props.breadcrumbs) output? undefined
4.) I assume withBreadcrumbs()(ScenarioManagerHome) is being mounted somewhere? (not the connect-wrapped version) I did not understand this
5) "react-router-dom": "^4.2.2",
from react-router-breadcrumbs-hoc.
Ok, I'm using 4.3.1, but it shouldn't make a difference... Something else you could try is copying the example component directly into a new component in your codebase and mounting it somewhere. This would rule out any possible issues with your component.
You're probably already doing this, but to be sure... wherever your breadcrumbs component is, it also needs to be nested somewhere within a router component to work. If it sits outside a router component it will error.
from react-router-breadcrumbs-hoc.
My app js code. Is there anything missing here ?
class _App extends React.Component<Props> {
render() {
return (
<Provider store={store}>
<BrowserRouter>
<Bootstrap>
<Switch>
{routes.map((item, index) => {
return (
<SensemakerRoute
key={index}
path={item.path}
exact={item.exact}
component={item.component}
store={store}
/>
);
})}
</Switch>
</Bootstrap>
</BrowserRouter>
</Provider>
);
}
}
export const App = _App;
from react-router-breadcrumbs-hoc.
Looks ok to me - whatever component you use the HOC in just needs to be somewhere nested within <BrowserRouter>
I'm not sure what <Bootstrap>
is...
With problems like these it's sometimes better to start fresh to rule out issues. I should have some time to setup a codesandbox link tonight (US Pacific) if you're still having trouble.
from react-router-breadcrumbs-hoc.
<Bootstrap>
is my another HOC. I have tried but eventually could not get the breadcrumbs up and running.
from react-router-breadcrumbs-hoc.
Fixed this issue. Closing it.
from react-router-breadcrumbs-hoc.
When you have a moment, could you please post back with a description the issue and how you fixed it? Might help others down the road!
from react-router-breadcrumbs-hoc.
Related Issues (20)
- Translated breadcrumbs (delaying routes init) HOT 1
- dassad
- Unnecessary peer dependency on react-router-dom HOT 4
- "//" produces double matches HOT 1
- Unable to pass additional props. HOT 3
- define breadcrumbโs description HOT 2
- Disabling default generated breadcrumbs by passing breadcrumb: null raises an error HOT 2
- Property 'match' does not exist on type 'ReactNode' HOT 1
- What to use instead of InjectedProps HOT 3
- Replacing react-router with react-router-dom HOT 2
- Fixed
- Suppress autmatically added Home Breadcrumb HOT 2
- Issue with excludePaths not being consistent with breadcrumbs: null HOT 6
- Question about type definition HOT 3
- typescript definition mistake HOT 1
- How do I add in between crumbs ? HOT 2
- Question: Is there a way to not export the current page in breadcrumbs HOT 2
- Question: breadcrumbs propTypes HOT 1
- How to remove "-" from titles HOT 3
- react-router v6 HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-router-breadcrumbs-hoc.