Documentation
Base
Contexts
StoriesContext

useStoriesContext

Description

The useStoriesContext hook is a React hook designed to manage the state and behavior of stories within a component. It handles the navigation between stories, the current story index, and any associated props or child elements. This hook is particularly useful for implementing story-like features in applications where users can navigate through different stories.

Properties

PropertyTypeDescription
canNextbooleanIndicates whether the next story can be shown.
canPreviousbooleanIndicates whether the previous story can be shown.
childrenReact.ReactNodeThe children elements of the stories.
configStoryConfigurationConfiguration for the current story.
configure(config: StoryConfiguration) => voidFunction to update the current story configuration.
currentnumberThe current story index.
lengthnumberThe total number of stories.
mountednumberIndicates that stories context was mounted.
nextFunctionFunction to show the next story.
previousFunctionFunction to show the previous story.
show(index: number) => voidFunction to show a specific story by index.