Skip to content

Balldoro/react-routie

Repository files navigation

React Routie

React Routie is a tiny client-side routing library for React

npm

Installation

npm install react-routie

Quickstart

import { Link, NestedRoute, Redirect, Route, Router } from 'react-routie';

const App = () => {
  return (
    <Router>
      <Route path="/" page={<h1>Home page!</h1>} />
      <Route
        path="/dashboard"
        page={
          <main>
            <h1>Dashboard page!</h1>
            <Link
              path="/dashboard/charts"
              style={({ isActive }) => ({
                color: isActive ? 'orange' : 'black',
              })}
            >
              Go to charts!
            </Link>
            <NestedRoute />
          </main>
        }
      >
        <Route
          path="/charts"
          page={
            <div>
              <h2>Nested route!</h2>
              <Link path="/dashboard">Go back to Dashboard!</Link>
            </div>
          }
        />
      </Route>
      <Route path="/*" page={<h1>Catch them all!</h1>} />
    </Router>
  );
};

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published