HeaderMenuItem element bug with typescript
See original GitHub issueHello, I am using the latest version of carbon-components-react v7.10.2
with typescript.
I have the following issue, when I pass element prop element={NavLink}
and I got the following error:
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Typescript and destructured variables not recognising props
I have a function that returns data . The object that gets returned contains headerMenu, page, content and ...
Read more >1. Installing Carbon
Welcome to Carbon! This tutorial will guide you in creating a React app with the Carbon Design System.
Read more >cannot be used as a jsx component. its return type 'element
Describe the Bug. When using the Link component with TypeScript in a JSX file you will get an error: 'NextLink' cannot be used...
Read more >Tooltip Component - Angular Data Grid
Feb 8. What's new in AG Grid 27.0.0. Major release with new features and bug fixes. 100% React Rendering; Typescript Example ...
Read more >Releases | Adjust Atlas
Bug fixes. Fixed input's width to be 100% when ComboBox component is in input kind so that it looks like a usual input...
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 FreeTop 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
Top GitHub Comments
To anyone who finds this.
@ilievZlatko’s problem occurs when using Carbon in a TS project.
Your issue is probably related to this: https://github.com/DefinitelyTyped/DefinitelyTyped/issues/44772
You just need to import the
LinkProps
fromreact-router-dom
(it will probably work withNavLinkProps
as well) and use it with the Carbon component. It even works with React Router v6.0.0-alpha.5 (yarn add react-router@next react-router-dom@next
as of today)Example:
Image of the code above:
This actually works for both
<HeaderName>
and<SideNavLink>
For
<SideNavLink>
you to apply it the same: