Skip to content

useScrollTo ​

sensors
test coverage
Last changed: 24 days ago

Hook for scrolling to a specific element

typescript
import { useScrollTo } from '@siberiacancode/reactuse';

Usage ​

typescript
const trigger = useScrollTo(ref, options);
// or
const { ref, trigger } = useScrollTo(options);

Demo ​

Api ​

Parameters

NameTypeDefaultNote
targetHookTarget-The target element for scrolling to
options?UseScrollToOptions-The scroll options

Parameters

NameTypeDefaultNote
options?UseScrollToOptions-The scroll options

Source ​

Source • Demo

Contributors ​

Avatardebabin
Avatarzeroqs

Released under the MIT License.