Skip to content

paranatural/turntable

Repository files navigation

⬡ Turntable

Framework-agnostic flexible SPA router

⬡ Motivation/Promise

There are plenty of client-side routing libraries, but all of them aren't really lightweight and do not support middlewares or guards out-of-the-box

⬡ Features

⬡ Installation

npm i @paranatural/turntable @paranatural/turntable-stdlib @paranatural/turntable-react
yarn add @paranatural/turntable @paranatural/turntable-stdlib @paranatural/turntable-react
pnpm add @paranatural/turntable @paranatural/turntable-stdlib @paranatural/turntable-react

⬡ Usage/Utilizing/Enjoyment

import React from 'react'
import ReactDom from 'react-dom'
import { Ghostship } from '@ghostship/core'
import { GhostshipComponent } from '@ghostship/react'

import { HomePage, PostPage, NotFoundPage } from './components/pages'

const ghostship = new Ghostship(
  // routes tree
  [{
    path: '/',
    component: HomePage,
  }, {
    path: '/post/:slug',
    components: PostPage,
  }],
  // options
  {
    trailingSlash: true,
    notFound: NotFoundPage
  }
)

ReactDom.render(
  <GhostshipComponent instance={ghostship} />,
  document.getElementById('react')
)

⬡ API

⬡ Contribution

Feel free to open an issue/discussion with request/report, but ensure you read/follow Contributor Covenant Code of Conduct

⬡ Development/History

Changelog/Past/Versions

Roadmap/Future

⬡ Legal info

Project licensed under MIT License. What it means

⬡ Brand/Look

Project name, logo, visual design and writing style heavily inspired by Control game (made by Remedy Entertainment)