Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
elysia-react-router
Advanced tools
Use React Router v7 or Remix with Elysia with HMR
support! Closes a long-standing elysia plugin request https://github.com/elysiajs/elysia/issues/12
[!IMPORTANT]
In development
mode it uses vite
under the hood, and in production
serves the build directory and performs SSR requests.
import { Elysia } from "elysia";
import { reactRouter } from "elysia-react-router";
new Elysia()
.use(await reactRouter())
.get("/some", "Hello, world!")
.listen(3000, console.log);
bun create react-router@latest --template kravetsone/elysia-react-router/example
Key | Type | Default | Description |
---|---|---|---|
mode? | "development" | "production" | process.env.NODE_ENV || "development" | In development mode it starts vite , and in production it just serves static and performs SSR requests. |
basename? | string | "/" | The base path for the application. This should match the basename in your vite config. |
buildDirectory? | string | "build" | The directory where the application is built. This should match the buildDirectory directory in your vite config. |
serverBuildFile? | string | "index.js" | The server output filename. This should match the serverBuildFile filename in your vite config. |
vite? | InlineConfig | Configure vite server in development mode. | |
static? | StaticOptions | Configure static plugin options in production mode | |
getLoadContext? | (context: Context) => AppLoadContext | Promise | A function that returns the value to use as context in route loader and action functions. |
In Elysia:
new Elysia()
.use(
await reactRouter({
getLoadContext: () => ({ hotPostName: "some post name" }),
})
)
.listen(port, console.log);
declare module "react-router" {
interface AppLoadContext {
hotPostName?: string;
}
}
In React Router:
import { useLoaderData } from "react-router";
import type { Route } from "./+types/posts._index";
export const loader = async ({ context }: Route.LoaderArgs) => {
return {
...context,
posts: [
{
slug: "my-first-post",
title: "My First Post",
},
{
slug: "90s-mixtape",
title: "A Mixtape I Made Just For You",
},
],
};
};
export default function Posts() {
const { posts, hotPostName } = useLoaderData<typeof loader>();
return (
<main>
<h1>Posts</h1>
<p>🔥🔥 {hotPostName} 🔥🔥</p>
<ul>
{posts.map((post) => (
<li key={post.slug}>
<p>{post.title}</p>
</li>
))}
</ul>
</main>
);
}
The remix
function is deprecated and will be reworked in future versions. Please use reactRouter
for better compatibility and features. [More info on remix vs react-router v7]
(https://remix.run/blog/incremental-path-to-react-19)
The remix
function has the same options and types as reactRouter
. Example usage:
bun i elysia-remix@latest @remix-run/node@latest
import { Elysia } from "elysia";
import { remix } from "elysia-remix";
new Elysia()
.use(await remix())
.get("/some", "Hello, world!")
.listen(3000, console.log);
[!IMPORTANT] The Remix functionality will be reworked in future versions, as Remix plans to release a new reworked version of the framework with new ideas under the old name
Remix
.
import { remix } from "elysia-remix";
import { reactRouter } from "elysia-remix/react-router";
import { reactRouter } from "elysia-react-router";
import { remix } from "elysia-react-router/remix";
FAQs
Use React Router v7 or Remix with Elysia with HMR support!
The npm package elysia-react-router receives a total of 24 weekly downloads. As such, elysia-react-router popularity was classified as not popular.
We found that elysia-react-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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.