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
-[Note on `<Route path>` patterns](#note-on-route-path-patterns)
38
+
-[Note on `<Link to>` values](#note-on-link-to-values)
39
+
-[Use useRoutes instead of react-router-config](#use-useroutes-instead-of-react-router-config)
40
+
-[Use navigate instead of history](#use-navigate-instead-of-history)
41
41
-[Rename `<Link component>` to `<Link as>` and `<NavLink exact>` to `<NavLink end>`](#rename-link-component-to-link-as-and-navlink-exact-to-navlink-end)
42
+
-[Remove `activeClassName` and `activeStyle` props from `<NavLink />`](#remove-activeclassname-and-activestyle-props-from-navlink-)
42
43
-[Get `StaticRouter` from `react-router-dom/server`](#get-staticrouter-from-react-router-domserver)
43
44
-[Move `basename` from `<Router>` to `<Routes>`](#move-basename-from-router-to-routes)
45
+
-[What did we miss?](#what-did-we-miss)
44
46
45
47
## Upgrade to React v16.8
46
48
@@ -708,6 +710,59 @@ function SomeForm() {
708
710
This is a simple renaming of a prop to better align with the common practice of
709
711
other libraries in the React ecosystem including styled-components and Reach UI.
710
712
713
+
## Remove `activeClassName` and `activeStyle` props from `<NavLink />`
714
+
715
+
As of `v6.0.0-beta.3`, the `activeClassName` and `activeStyle` props have been removed from `NavLinkProps`. Instead, you can pass a function to either `style` or `className` that will allow you to customize the inline styling or the class string based on the component's active state.
A `<NavLink>` is a special kind of [`<Link>`](#link) that knows whether or not it is "active". This is useful when building a navigation menu such as a breadcrumb or a set of tabs where you'd like to show which of them is currently selected.
354
+
A `<NavLink>` is a special kind of [`<Link>`](#link) that knows whether or not it is "active". This is useful when building a navigation menu such as a breadcrumb or a set of tabs where you'd like to show which of them is currently selected. It also provides useful context for assitive technology like screen readers.
355
355
356
-
Both `<NavLinkactiveClassName>` and/or `<NavLink activeStyle>` are applied to the underlying `<Link>` when the route it links to is currently active.
356
+
By default, an `active` class is added to a `<NavLink>` component when it is active. This provides the same simple styling mechanism for most users who are upgrading from v5. One difference as of `v6.0.0-beta.3` is that `activeClassName` and`activeStyle` have been removed from `NavLinkProps`. Instead, you can pass a function to either `style` or `className` that will allow you to customize the inline styling or the class string based on the component's active state.
0 commit comments