0.1.0 • Published 5 years ago

peppermint-router v0.1.0

Weekly downloads
494
License
MIT
Repository
github
Last release
5 years ago

peppermint-router

Lightweight hash router for React

package size npm version npm license dependencies

The gist

<RouterView>
    <Route path="/" component={HomePage} />
    <Route path="home" component={HomePage} />
    <Route path="about" component={AboutPage} />
    <RouteFallback component={NotFound} />
</RouterView>

Prompt navigation

<PromptNavigation
    enabled={true}
    exitPrompt="Leave the application?"
>
    {({ isNavigating, confirm, cancel }) => (
        isNavigating && (
            <div>
                <span>Move to another page?</span>
                <button onClick={confirm}>Confirm</button>
                <button onClick={cancel}>Cancel</button>
            </div>
        )
    )}
</PromptNavigation>

Why?

  • Extremely compact - less than 2kb gzipped!
  • Does not require special <Link> tags and other boilerplate.
  • <PromptNavigation> component with custom prompt out of the box.

Why not?

  • Only hash routes
  • No SSR support
  • No React Native support

Changelog

The change log can be found here.

0.1.0

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago

0.0.0

5 years ago