Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

next-pages-path-gen

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-pages-path-gen

Pages path generator for Next.js.

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

next-pages-path-gen

Generate pages path for Next.js.

Install

$ yarn add -D next-pages-path-gen
$ npm i -D next-pages-path-gen

you can not use with npx

Setup

package.json

{
  "scripts": {
    "build:path": "next-pages-path-gen"
  }
}

Usage

import Link from "next/link"
import { pagesPath } from "../lib/path"

console.log(pagesPath.post.create.$query()) // { pathname: '/post/create' }
console.log(pagesPath.post._pid(1).$query()) // { pathname: '/post/[pid]', query: { pid: 1 }}

export default () => {
  const onclick = useCallback(() => {
    router.push(pagesPath.post._pid(1).$query())
  }, [])

  return (
    <>
      <Link href={pagesPath.post._pid(1).$query()} />
      <div onclick={onclick} />
    </>
  )
}

License

MIT License.

Keywords

typescript

FAQs

Package last updated on 17 Aug 2021

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