
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
easy-page-router
Advanced tools
easy-page-router is a lightweight and easy-to-use JavaScript routing package that simplifies navigation in vanilla JavaScript, React, and React Native applications.
easy-page-router is a lightweight and easy-to-use JavaScript routing package that simplifies navigation in vanilla JavaScript, React, and React Native applications.
npm install easy-page-router
import { Router, RouterProvider } from "easy-page-router";
function App() {
return (
<RouterProvider>
<Layout>
<Router
renderPage={({ path }) => {
if (path.length === 0) {
// "/"
return <HomePage />;
} else if (path[0] === "song" && path[1]) {
// "/song/:id"
return <SongPage songId={path[1]} />;
}
return <NotFoundPage />;
}}
/>
</Layout>
</RouterProvider>
);
}
The variable state offers the values "active" | "back" | "forward" so it is possible to set animations via CSS (react) or Animated (react-native) on change. All pages remain rendered.
import { Router } from "easy-page-router";
function PageRouter() {
return <Router
renderAnimation={Animation}
renderPage={({ path }) => {
if (path.length === 0) {
return <HomePage />;
} else if (path[0] === "song" && path[1]) {
return <SongPage songId={path[1]} />;
}
return <NotFoundPage />;
}}
/>;
}
function Animation({ page, state }: RenderAnimationProps) {
const [newClass, setNewClass] = useState("new");
useEffect(() => {
if (state !== "active") setNewClass("");
}, [state]);
return <div className={`page-animation ${state} ${newClass}`}>{page}</div>;
}
import { Router, RouterProvider, useRouter } from "easy-page-router";
import { Link, useTitle } from "easy-page-router/react";
import { Link } from "easy-page-router/react-native";
type UseRouter = {
path: string[];
searchParams: Record<string, string>;
state: "active" | "back" | "forward";
href: string;
to: string;
pageKey: string;
push: (to: string) => void;
back: () => void;
forward: () => void;
}
When a Link
component is active in React, it receives the active
className
for styling, while in React Native, the styleActive
prop is applied instead.
FAQs
easy-page-router is a lightweight and easy-to-use JavaScript routing package that simplifies navigation in vanilla JavaScript, React, and React Native applications.
The npm package easy-page-router receives a total of 11 weekly downloads. As such, easy-page-router popularity was classified as not popular.
We found that easy-page-router demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.