
Security News
Crates.io Users Targeted by Phishing Emails
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
react-router-dom-wrapping
Advanced tools
Custom route wrapping functionality for react-router-dom
$ npm install --save react-router-dom-wrapping
or
$ yarn add react-router-dom-wrapping
Type: IncomingRoute[]
. IncomingRoute extends { children?: IncomingRoute[] }
Type: (keyof IncomingRoute)[]
Type: (props: IRouteWrapperProps<IncomingRoute>) => React.ReactNode
route
IncomingRouteconfig
IReactDomRoutesWrapperConfig
/**
* - title setting
* - lazy loading (Suspence)
* - ErrorBoundary
*/
export const RouteWrapper: FC<TExtendedRouteObject> = ({ element, title }) => {
useEffect(() => {
document.title = title;
}, [title]);
const pendingMessage = useMemo(() => `Page is loading - ${title}`, [title]);
return (
<Suspense fallback={<div>{pendingMessage}</div>}>
<ErrorBoundary>
{element}
</ErrorBoundary>
</Suspense>
);
};
const config: IReactDomRoutesWrapperConfig<IIncomingRoute> = {
routes: [
{
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
title: 'first',
children: [
{
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
title: 'first-first',
children: [
{
title: 'first-first-first',
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
}
],
}
],
},
{
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
title: 'second',
children: [
{
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
title: 'second-first',
children: [
{
title: 'second-first-first',
fieldToOmit1: 'fieldToOmit1',
fieldToOmit2: 'fieldToOmit2',
}
],
}
],
},
],
fieldsToOmit: [
'fieldToOmit1',
'fieldToOmit2',
],
wrapRoute: (props) => <RouteWrapper element={<div>test<div/>} title={props.route.title} />,
};
const routes = wrapRoutes<IIncomingRoute, OutcomingRoute>(config);
MIT © Kas Elvirov
FAQs
Custom route wrapping functionality for react-router-dom
We found that react-router-dom-wrapping 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.
Security News
The Rust Security Response WG is warning of phishing emails from rustfoundation.dev targeting crates.io users.
Product
Socket now lets you customize pull request alert headers, helping security teams share clear guidance right in PRs to speed reviews and reduce back-and-forth.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.