1.0.7 • Published 1 year ago

@moveread/router-tools v1.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Router Tools

Tools for react-router-dom

useSplitPath

Split the current path into parent and children routes

import { useSplitPath } from '@moveread/router-tools'

function Parent() {
  return useRoutes([{
    path: '/nested/path/*',
    element: <Nested />
  }])
}

function Nested() {
  const [pre, post] = useSplitPath() // ['/nested/path', '/children/path']
  return useRoutes([{
    path: '*',
    element: <Navigate to='children/path' />
  }])
}
1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago