Giter Site home page Giter Site logo

Comments (9)

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

ShadyXV avatar ShadyXV commented on May 31, 2024

Thank you for responding so quickly.Here is the full error detail.
screenshot-2017-12-27 honeyguide apps 1
I am not passing any props to Breadcrumbs is this where i am going wrong.

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

ShadyXV avatar ShadyXV commented on May 31, 2024

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.

ShadyXV avatar ShadyXV commented on May 31, 2024

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.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

ShadyXV avatar ShadyXV commented on May 31, 2024

Yup. You are right.It's working now.Thank you.
I'll use [email protected] for now.
Happy Holidays!

from react-router-breadcrumbs-hoc.

icd2k3 avatar icd2k3 commented on May 31, 2024

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.

icd2k3 avatar icd2k3 commented on May 31, 2024

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)

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.