Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@jackgreen/react-router-view
Advanced tools
全局路由组件,配置化路由,所有 Switch/Route 的地方都可以替换
npm i @jackgreen/react-router-view
const routes: RouteConfig[] = [
{
path: '/single',
component: Single
},
{
path: '/multi',
component: Multi,
childRoutes: [
{
path: '/multi/child1',
component: Child1
},
{
path: '/multi/child2',
component: Child2
}
]
}
]
function Multi(props) {
return (
<div>
<Link to='/multi/child1'>child1</Link>
<Link to='/multi/child2'>child2</Link>
// 二级路由 // 必须透传 props // props 中 routes,所以不需要单独传 routes
<ReactRouterView {...props} />
</div>
)
}
function App() {
return (
<BrowserRouter>
<Link to='/single'>single</Link>
<Link to='/multi'>multi</Link>
// 一级路由 // 必须在 Router 中 // 并且传入 routes // 透传 props 看需求
<ReactRouterView {...props} routes={routes} />
</BrowserRouter>
)
}
继承 RouteProps
import { RouteProps } from 'react-router'
export interface RouteConfig extends RouteProps {
// 路由访问 url
path: string
// react 组件
component: React.ComponentType<any>
// 子路由,需要在本组件引入 ReactRouterView,用来渲染 Route 组件
childRoutes?: RouteConfig[]
}
FAQs
全局路由组件,配置化路由,所有 Switch/Route 的地方都可以替换
The npm package @jackgreen/react-router-view receives a total of 0 weekly downloads. As such, @jackgreen/react-router-view popularity was classified as not popular.
We found that @jackgreen/react-router-view demonstrated a not healthy version release cadence and project activity because the last version was released 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.