MCPcopy Create free account
hub / github.com/editablejs/editable / useActiveSection

Function useActiveSection

apps/docs/src/hooks/useActiveSection.ts:3–14  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1import { useRouter } from 'next/router'
2
3export function useActiveSection(): 'learn' | 'apis' | 'home' | 'playground' {
4 const { asPath } = useRouter()
5 if (asPath.startsWith('/apis')) {
6 return 'apis'
7 } else if (asPath.startsWith('/learn')) {
8 return 'learn'
9 } else if (asPath.startsWith('/playground')) {
10 return 'playground'
11 } else {
12 return 'home'
13 }
14}

Callers 4

HeaderFunction · 0.90
PageFunction · 0.90
MarkdownPageFunction · 0.90
NavFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…