Comments (9)
Hey @ShadyXV could you please post your full source code for the file you're using the HOC in? Also, showing the full error details ("15 stack frames were collapsed") could help.
I'm on vacation currently, but should have time to check on this during my travels.
Thanks!
from react-router-breadcrumbs-hoc.
Thank you for responding so quickly.Here is the full error detail.
I am not passing any props to Breadcrumbs is this where i am going wrong.
from react-router-breadcrumbs-hoc.
The hoc will automatically pass a breadcrumbs
prop into the wrapped component. You can pass additional props if you like, but it shouldn't matter in terms of rendering. When you have a moment could you paste the full source of Breadcrumbs/index.jsx
? Thanks
from react-router-breadcrumbs-hoc.
Breadcrumbs/index.jsx
looks like this
import React from "react";
import { NavLink } from "react-router-dom";
import { withBreadcrumbs } from "react-router-breadcrumbs-hoc";
const UserBreadcrumb = ({ match }) => <span>{match.params.userId}</span>; // use match param userId to fetch/display user name
const routes = [
{ path: "/", breadcrumb: "Home" },
{ path: "users", breadcrumb: "Users" },
{ path: "users/:userId", breadcrumb: UserBreadcrumb },
{ path: "something-else", breadcrumb: ":)" }
];
const Breadcrumbs = ({ breadcrumbs }) => (
<div>
{breadcrumbs.map(({ breadcrumb, path, match }) => (
<span key={path}>
<NavLink to={match.url}>{breadcrumb}</NavLink>
<span>/</span>
</span>
))}
</div>
);
export default withBreadcrumbs(routes)(Breadcrumbs);
from react-router-breadcrumbs-hoc.
I trying rendering Breadcrumbs in different ways but even just importing it fails with the same errors.
I am importing Breadcrumbs from Breadcrumbs/index.jsx like so
import Breadcrumbs from './components/Breadcrumbs';
i am using this in a create-react-app project, react v16.2.0, react-router-dom v4.2.2
from react-router-breadcrumbs-hoc.
Hey @ShadyXV I'll have to take a closer look at this in the near future. Not quite sure what might be happening as of yet.
The build process recently switched (PR: #9) ... I wonder if there is possibly some unintended side effects from that. Could you try downgrading npm i [email protected]
and see if that fixes the issue?
from react-router-breadcrumbs-hoc.
Yup. You are right.It's working now.Thank you.
I'll use [email protected] for now.
Happy Holidays!
from react-router-breadcrumbs-hoc.
Thanks @ShadyXV I was able to repro your issue using create-react-app
myself. I'll look into fixing the issue and close this thread with v 1.1.1
when fixed!
Edit: pinging @mhelmer who might have some suggestions here.
from react-router-breadcrumbs-hoc.
This one took a while to figure out, but seems the create-react-app
config has trouble with .mjs
file extensions. I've changed the build output in v 1.1.1
here: #14
This should fix the issue, can you confirm on your end everything is still working @ShadyXV after upgrading from 1.0.7
to 1.1.1
?
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.