Correctly destructure component in withBreadcrumbs.js
See original GitHub issueWithin 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:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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! 🍻
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.