You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Install react router and react router-dom 6.2.2 in a typescript project
Try to use a <NavLink from react router dom without any children.
Typescript expects NavLink to have an attribute called children set and is required. React expects children attributes to be passed as child nodes. The attribute isn't optional and can't be omitted without TS errors.
Expected Behavior
<NavLink to={'somelink'} />
Should work without any children or specifying a children attribute.
Actual Behavior
Error in typescript:
Property 'children' is missing in type '{ to: string; className: string; }' but required in type 'NavLinkProps'
The text was updated successfully, but these errors were encountered:
What version of React Router are you using?
6.2.2
Steps to Reproduce
Typescript expects NavLink to have an attribute called children set and is required. React expects children attributes to be passed as child nodes. The attribute isn't optional and can't be omitted without TS errors.
Expected Behavior
Should work without any children or specifying a children attribute.
Actual Behavior
Error in typescript:
Property 'children' is missing in type '{ to: string; className: string; }' but required in type 'NavLinkProps'
The text was updated successfully, but these errors were encountered: