Documentation
External
Hooks
useKeyboardMovement

useKeyboardMovement

Description

The useKeyboardMovement hook is a React hook designed for handling keyboard events to facilitate story or page navigation. This hook leverages external contexts from @react-instastories/base to enable navigation functionality via keyboard inputs.

Properties

PropertyTypeDescription
contextObjectObject that contains functions for next and previous functionality on keyboard events
context.nextFunctionFunction that causes on next keyboard event (right arrow)
context.previousFunctionFunction that causes on previous keyboard event (left arrow)

Usage

const stories = useStoriesContext();
 
useKeyboardMovement(stories);