New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sect/use-placeholder-path

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sect/use-placeholder-path

A custom React hook to retrieve placeholder path in Next.js App Router.

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23
decreased by-41.03%
Maintainers
1
Weekly downloads
 
Created
Source

@sect/use-placeholder-path

Release codecov CodeQL npm version NPM

A custom React hook to retrieve placeholder path in Next.js App Router.

Why

Next.js 13+ App Router does NOT have a method to return the path of placeholder value like useRouter().pathname in Pages Router.

This hook allows you to get the path of a placeholder value, such as useRouter().pathname in Pages Router, on the Next.js App Router.

Installation

npm install @sect/use-placeholder-path
# or
yarn add @sect/use-placeholder-path
# or
pnpm add @sect/use-placeholder-path

Usage

'use client';

import usePlaceholderPath from '@sect/use-placeholder-path';

const MyComponent = () => {
  const placeholderPath = usePlaceholderPath();
  
  return (
    <div>
      <p>Current placeholder path: {placeholderPath}</p>
    </div>
  );
}

export default MyComponent;

Examples

  1. For a route like /users/123/posts/456 with params { userId: '123', postId: '456' }:

    • placeholderPath will be /users/[userId]/posts/[postId]
  2. For a catch-all route like /blog/2024/08/15 with params { slug: ['2024', '08', '15'] }:

    • placeholderPath will be /blog/[...slug]

Notes

Changelog

See CHANGELOG.

✌️

A little project by @sectsect

Keywords

FAQs

Package last updated on 10 Aug 2024

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc