We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9bca154 commit 1fd3393Copy full SHA for 1fd3393
packages/smooth-core/src/client/NavLink.js
@@ -0,0 +1,18 @@
1
+import React from 'react'
2
+import { NavLink as BaseNavLink } from 'react-router-dom'
3
+import PageContext from './PageContext'
4
+
5
+function computeTo(to, lang) {
6
+ if (lang) {
7
+ return `/${lang}${to}`
8
+ }
9
+ return to
10
+}
11
12
+export default function NavLink(props) {
13
+ return (
14
+ <PageContext.Consumer>
15
+ {({ lang }) => <BaseNavLink {...props} to={computeTo(props.to, lang)} />}
16
+ </PageContext.Consumer>
17
+ )
18
packages/smooth-core/src/router.js
@@ -1 +1,10 @@
+export {
+ withRouter,
+ matchPath,
+ generatePath,
+ Switch,
+ Route,
+ Redirect,
+} from 'react-router-dom'
export { default as Link } from './client/Link'
+export { default as NavLink } from './client/NavLink'
0 commit comments