virtual-history-v5
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

virtual-history-v5

Installation

Npm

npm install virtual-history-v5

Yarn

yarn add virtual-history-v5

SET UP

import VirtualHistoryProvider under BrowserRouter

import { VirtualHistoryProvider } from "virtual-history-v5"

ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
  <BrowserRouter>
   <VirtualHistoryProvider>
      <Switch>
       ...
      </Switch>
    </VirtualHistoryProvider>
  </BrowserRouter>,
)

HOW TO USE

import { useVirtualHistory  } from "virtual-history-v5"

const { histories, clearHistory, restartWith, moveTo } = useVirtualHistory()
parameters description
histories list of history
clearHistory index optional
target index
default: 0
clear history list
close all history
restartWith location
locator of react router
like history.push(location)
clear all history
and replace first order with specific
moveTo key
key of location
example: kv67oi
change the current location to target
if target stay before current it uses go(-...)
if target stay after current it uses go(...)

Readme

Keywords

none

Package Sidebar

Install

npm i virtual-history-v5

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

16.4 kB

Total Files

33

Last publish

Collaborators

  • chamick7