Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@types/react-router
Advanced tools
TypeScript definitions for React Router
@types/react-router provides TypeScript type definitions for the react-router library, which is used for routing in React applications. These type definitions help developers use react-router with TypeScript, ensuring type safety and better developer experience.
Route Definitions
Defines a route in a React application, specifying the path and the component to render.
import { Route } from 'react-router-dom';
const App = () => (
<Route path="/home" component={HomeComponent} />
);
Link Component
Creates navigational links in a React application, allowing users to navigate between different routes.
import { Link } from 'react-router-dom';
const Navigation = () => (
<nav>
<Link to="/home">Home</Link>
<Link to="/about">About</Link>
</nav>
);
useHistory Hook
Provides access to the history instance, allowing programmatic navigation within a React component.
import { useHistory } from 'react-router-dom';
const NavigateButton = () => {
const history = useHistory();
const handleClick = () => {
history.push('/home');
};
return <button onClick={handleClick}>Go Home</button>;
};
useParams Hook
Extracts route parameters from the URL, making them available within a React component.
import { useParams } from 'react-router-dom';
const UserProfile = () => {
const { userId } = useParams<{ userId: string }>();
return <div>User ID: {userId}</div>;
};
Provides TypeScript type definitions for the react-router-dom library, which is a specific implementation of react-router for web applications. It includes additional components like BrowserRouter and HashRouter.
Provides TypeScript type definitions for the react-router-redux library, which integrates react-router with Redux for state management. It allows for synchronized routing and state management.
Provides TypeScript type definitions for the @reach/router library, which is an alternative to react-router with a focus on accessibility and simplicity. It offers a similar API but with some differences in implementation and features.
npm install --save @types/react-router
This package contains type definitions for React Router (https://github.com/ReactTraining/react-router).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-router.
These definitions were written by Sergey Buturlakin, Yuichi Murata, Václav Ostrožlík, Nathan Brown, Alex Wendland, Kostya Esmukov, John Reilly, Karol Janyst, Dovydas Navickas, Huy Nguyen, Jérémy Fauvel, Daniel Roth, Egor Shulga, Rahul Raina, Duong Tran, Ben Smith, Wesley Tsai, Sebastian Silbermann, Nicholas Hehr, and Pawel Fajfer.
FAQs
TypeScript definitions for React Router
The npm package @types/react-router receives a total of 2,977,997 weekly downloads. As such, @types/react-router popularity was classified as popular.
We found that @types/react-router 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.