Skip to content
This repository was archived by the owner on Feb 4, 2020. It is now read-only.
/ hash-source Public archive

A hash router source for @reach/router

License

will-stone/hash-source

Repository files navigation

DEPRECATED

This project is no longer being maintained, and I'm no longer fixing bugs. With the announcement that Reach Router is being merged into React Router, this project is no longer required and I suggest you move over to React Router. Please contact me if you would like to adopt this project. You can also fork it on GitHub.

Hash Source

This is an addon for Reach Router to allow you to use hash history.

e.g.

example.com/#/about
example.com/#/contact

Install

npm i hash-source
# or
yarn add hash-source

Usage

import { createHistory, Link, LocationProvider, Router } from '@reach/router'
import createHashSource from 'hash-source'
import React from 'react'
import ReactDOM from 'react-dom'
import About from './routes/About'
import Contact from './routes/Contact'
import Home from './routes/Home'

let source = createHashSource()
let history = createHistory(source)

const App = () => {
  return (
    <LocationProvider history={history}>
      <header>
        <nav>
          <Link to="/">Home</Link>
          <Link to="about">About</Link>
          <Link to="contact">Contact</Link>
        </nav>
      </header>

      <hr />

      <Router>
        <Home path="/" />
        <About path="about" />
        <Contact path="contact" />
      </Router>
    </LocationProvider>
  )
}

About

A hash router source for @reach/router

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

  •  

Packages

No packages published