
Security News
AGENTS.md Gains Traction as an Open Format for AI Coding Agents
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
@rbxtsx/react-router
Advanced tools
Welcome! This is the official documentation for the @rbxtsx/react-router
package. This package provides a routing solution for your Roblox experiences built with Roblox's TypeScript framework, RbxTs. It allows you to manage navigation between different UI components based on URL paths and includes support for animated transitions.
Author: Harihar Nautiyal
Installation:
npm install @rbxtsx/react-router
Features:
:paramName
).useRouter
and useParams
hooks.Getting Started:
import { RouterProvider, Routes, Route, Link, useRouter, useParams } from "@rbxtsx/react-router";
RouterProvider
:This component provides the context for routing and manages the current path. You can also set default transition properties here.
function App() {
return (
<RouterProvider transition="slide-left" transitionDuration={0.5}> {/* Default transition for all routes */}
{/* Your application components here */}
</RouterProvider>
);
}
Routes
: This component acts as a container for your routes. You can also override the default transition properties from the RouterProvider
.<Routes transition="fade" transitionDuration={0.3}> {/* Overrides default transition for routes within */}
<Route path="/" component={HomePage} />
<Route path="/about" component={AboutPage} />
<Route path="/products/:productId" component={ProductPage} />
</Routes>
Route
:path
: The URL pattern for this route.component
: The React component to render for this route.transition
(Optional): Overrides the parent Routes
or RouterProvider
transition.transitionDuration
(Optional): Overrides the parent Routes
or RouterProvider
transition duration.Link
:This component allows users to navigate between routes.
<Link to="/">Home</Link>
<Link to="/about">About</Link>
useRouter
hook: Returns the current routing context object.useParams
hook: Returns a map of captured parameters from the current route.Transitions:
The @rbxtsx/react-router
package provides several built-in transition types:
fade
: Fades the new component in and the old component out.slide-left
: Slides the new component in from the left and the old component out to the left.slide-right
: Slides the new component in from the right and the old component out to the right.slide-up
: Slides the new component in from the bottom and the old component out to the bottom.slide-down
: Slides the new component in from the top and the old component out to the top.You can set the transition type and duration on the RouterProvider
, Routes
, or individual Route
components. The order of precedence is Route
> Routes
> RouterProvider
.
Example with Transitions:
function App() {
return (
<RouterProvider transition="fade" transitionDuration={0.5}>
<nav>
<Link to="/">Home</Link>
<Link to="/about">About</Link>
<Link to="/products/123">Product 123</Link>
</nav>
<Routes>
<Route path="/" component={HomePage} />
<Route path="/about" component={AboutPage} transition="slide-right" /> {/* Overrides default to slide-right */}
<Route path="/products/:productId" component={ProductPage} />
</Routes>
</RouterProvider>
);
}
// ... (HomePage, AboutPage, ProductPage components remain the same)
In this example:
fade
transition with a duration of 0.5 seconds./about
route will override this to use a slide-right
transition, while keeping the 0.5-second duration.Additional Notes:
frame
, textbutton
, and TweenService
. Ensure you're familiar with these components for proper usage within Roblox.FAQs
React Router implementation for Roblox TypeScript
The npm package @rbxtsx/react-router receives a total of 5 weekly downloads. As such, @rbxtsx/react-router popularity was classified as not popular.
We found that @rbxtsx/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
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.
Security News
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.