tinyrouting-navigationhandler

2.0.0 • Public • Published

tinyrouting-navigationhandler

What is it for?

This is a tiny npm package that provides the ability to update a URL with a path. That's it. It can be used in conjunction with tinyrouting-routinghandler (https://www.npmjs.com/package/tinyrouting-routinghandler) in order to create routing logic and page re-renders based on routing.

Why?

A lot of routing libraries are either framework specific, large or both. The tinyRouting packages (https://github.com/magicthecat/tinyRouting) aim to provide atomic functions that can be used in a wide variety of applications and use cases.

Function Parameters

The function accepts a single string  path parameter, which represents the new path to navigate to.

How it works

Within the function it uses the History Web API which is part of the JavaScript Browser API. This s a set of built-in JavaScript APIs provided by web browsers.

Compatibility

Compatible with:

  • React (tested on v18.2.0)

  • Vue (tested on v3.3.2)

  • Vanilla Javascript

Examples

Note: these examples also use the  tinyrouting-routinghandler (https://www.npmjs.com/package/tinyrouting-routinghandler) for routing logic.

Code Sandbox Examples can be found here:

Package Sidebar

Install

npm i tinyrouting-navigationhandler

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

2.88 kB

Total Files

3

Last publish

Collaborators

  • magicthecat