
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@meniga/router
Advanced tools
Core is a library for handling routing and history
Customized versions of history from 'history' - This is not needed for react-router-6 and highly discouraged to use. This is only here temporarily while apps are being migrated to react-router v6.
Customized versions of Router from 'react-router-dom' (v6) which includes a ScrollManager
Direct exports from react-router-dom (v6)
This example shows you how to use the RouterProvider with routes as an array, but you can also use e.g. BrowserRouter directly and specify your routes as elements.
import React, { Fragment } from 'react'
import { createBrowserRouter, RouterProvider } from '@meniga/router'
import { routeConfig } from './routeConfig'
import { globalConfig } from '@meniga/config'
const _configBasename = globalConfig('routing.prefix', '')
const App = () => {
const browserRouter = createBrowserRouter(routeConfig(), { basename: _configBasename })
return <RouterProvider router={ browserRouter } />
}
export default App
Example routeConfig.js:
import React from 'react'
import { default as LayoutRoot } from './layouts/LayoutRoot'
import { default as LayoutError } from './layouts/LayoutError'
import { default as LayoutSimple } from './layouts/LayoutSimple'
import { default as LayoutDefault } from './layouts/LayoutDefault'
import Logout from './Logout'
import Login from './open/Login'
import Error503 from './Error503'
import Error404 from './Error404'
import NetworkError from './NetworkError'
import Protected from './protected/Protected'
export const routeConfig = () => {
const errorRoutes = [
{
key: 'error503Route',
element: <Error503 />,
path: '/503'
},
{
key: 'error404Route',
element: <Error404 />,
path: '/404'
},
{
key: 'errorNetworkRoute',
element: <NetworkError />,
path: '/error'
}
]
const simpleRoutes = [
{
key: 'logoutRoute',
element: <Logout />,
path: '/logout'
},
{
key: 'loginRoute',
path: '/login/:path?',
element: <Login />
}
]
const defaultRoutes = [
{
key: 'protectedRoutes',
path: '/:page?/*?',
element: <Protected />
}
]
const routes = [
{
element: <LayoutRoot />,
children: [
{
element: <LayoutError />,
children: errorRoutes
},
{
element: <LayoutSimple />,
children: simpleRoutes
},
{
element: <LayoutDefault />,
children: defaultRoutes
},
]
}
]
return routes
}
FAQs
The meniga router package
We found that @meniga/router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.