New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

simple-react-router-stack

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-react-router-stack

Simaple react router with no deps only context

latest
Source
npmnpm
Version
1.4.0
Version published
Maintainers
0
Created
Source

Simple React Router

Make simple navigation to add basic navigation in React application.

Example

Defining in root application file routers.

function App() {
  return (
    <NavigatorProvider
      onScreenChange={(...args) => {
        console.log(args);
      }}
      fallbackRouteName="main"
    >
      <NavigatorScreen
        name="home"
        component={Home}
        props={{
          internalName: "HomeScreen",
        }}
      />
      <NavigatorScreen name="main" component={Main} />
    </NavigatorProvider>
  );
}
PropNameDescriptionReturn value
onScreenChangeIf you need to be updated on change in navigation.{currScreenName: string; prevScreenName: string; }
fallbackRouteNameInitial screen. Default the first screen in stack declaration.

Need to navigate.

function Main() {
  const { goNextTo } = useContext(NavigatorContext);

  return (
    <div>
      <div>Main</div>
      <button
        onClick={() => {
          goNextTo("home");
        }}
      >
        Redirect
      </button>
    </div>
  );
}
PropNameDescriptionReturn value
goNextToNavigate to router by passing name
goBackNavigate back. Default nothing happens if no previous in stack
resetNavigate on first router in stack

Demo

Image

Keywords

react

FAQs

Package last updated on 07 Mar 2025

Did you know?

Socket

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.

Install

Related posts