New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@pulsor/location

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pulsor/location

Routing utilities for pulsor

latest
npmnpm
Version
0.0.2-rc.6
Version published
Maintainers
1
Created
Source

@pulsor/location

Routing utilities for pulsor

Installation

npm install @pulsor/location

Usage

Use the createRouter function to setup your routes. It will return a TrackLocation Action that you need to hook-up near the top of your app (above the router), then use the Router component where you want the routes to be rendered.

Routing

import { createRouter } from '@pulsor/location'

const { Router, TrackLocation } = createRouter({
  routes: {
    '/': <h1>Home page</h1>,
    '/about': <h1>About page</h1>,
    '/contact': <h1>Contact page</h1>,
  }
})

const app = (
  <main init={TrackLocation}>
    <header>App header</header>
    <Router />
    <footer>App footer</footer>
  </main>
)

Client-side navigation

Option 1

import { Navigate } from '@pulsor/location'

const GoToAboutPage = Navigate('/')

const app = (
  <button onclick={GoToAboutPage}>Go to About page</button>
)

Option 2

import { Link } from '@pulsor/location'

const app = (
  <Link href="/about">About page</Link>
)

Option 3

import { CaptureLinkClicks } from '@pulsor/location'

const app = (
  <main id="root" onclick={CaptureLinkClicks}>
    <nav>
      <a href="/about">About page</a>
    </nav>
  </main>
)

FAQs

Package last updated on 25 Feb 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts