Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

hash-source

will-stone11.9kMITdeprecated1.0.5TypeScript support: included

This project is no longer maintained, please use React Router instead

A hash router source for @reach/router

readme

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>
  )
}