Skip to content

Commit

Permalink
docs(core): exposing usePerspective and updating tsDoc
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Feb 6, 2025
1 parent be0fcc9 commit 6b7c5ef
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/sanity/src/core/perspective/usePerspective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ import {PerspectiveContext} from 'sanity/_singletons'
import {type PerspectiveContextValue} from './types'

/**
* @internal
* React hook that returns the current studio perspective and perspective stack.
*
* @public
* @returns See {@link PerspectiveContextValue}
* @example Reading the current perspective stack
* ```ts
* function MyComponent() {
* const {perspectiveStack} = usePerspective()
* // ... do something with the perspective stack ...
* }
* ```
*/
export function usePerspective(): PerspectiveContextValue {
const context = useContext(PerspectiveContext)
Expand Down

0 comments on commit 6b7c5ef

Please sign in to comment.