Giter Site home page Giter Site logo

Comments (15)

icd2k3 avatar icd2k3 commented on May 31, 2024

๐Ÿ‘‹ 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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024
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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

Is there something i am missing ? As per documentaion i have used it correctly ?

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

icd2k3 avatar icd2k3 commented on May 31, 2024

OH, also, which version of react-router are you using?

from react-router-breadcrumbs-hoc.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

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.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

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.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

<Bootstrap> is my another HOC. I have tried but eventually could not get the breadcrumbs up and running.

from react-router-breadcrumbs-hoc.

amitkumarsingh avatar amitkumarsingh commented on May 31, 2024

Fixed this issue. Closing it.

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on May 31, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.