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.

Correctly destructure component in withBreadcrumbs.js

See original GitHub issue

Within the file: withBreadcrumbs.js, I am trying to destructure the follow section:

const render = ({ breadcrumb, match, location, ...rest }) => { const componentProps = { match, location, key: match.url, ...rest }; if (typeof breadcrumb === 'function') { return createElement(breadcrumb, componentProps); } return createElement('span', componentProps, breadcrumb); };

My problem is that this component gets lumped into rest and then outputted into the span where it throws a console warning (due to some other internal workings in my app that don’t have anything to do with breadcrumbs). Any insight is appreciated

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
icd2k3commented, Feb 12, 2019

Hey, no worries! I don’t have a patreon, just happy to help. Your report also helped me identify a deeper design issue I’d like to fix soon, so this was valuable to me as well.

Let me know if you run into something else, cheers! 🍻

1reaction
icd2k3commented, Feb 12, 2019

Thank you for reporting!

I did some testing and I’m seeing this warning as well… flagging this as a bug and I will look into a fix in the near future.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Correctly destructuring this.props for the whole component
Correctly destructuring this.props for the whole component. Well you can't do that. Destructuring can only assign local variables so you'd ...
Read more >
Destructuring assignment - JavaScript - MDN Web Docs
The destructuring assignment syntax is a JavaScript expression that makes it possible to unpack values from arrays, or properties from ...
Read more >
Destructuring Props in React - Medium
Destructuring was introduced in ES6. It's a JavaScript feature that allows us to extract multiple pieces of data from an array or object...
Read more >
Destructure React Props with ES6 Object Destructuring for ...
Props make components reusable. To write cleaner code, you can destructure the props object into separate variables using ES6 object destructuring.
Read more >
Learn the basics of destructuring props in React
Destructuring in React is useful for both functional and class components but is achieved just a tad bit differently.
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