JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q32754F
  • License MIT

React Hook to makes scrolling the document to the specified coordinates easy.

Package Exports

  • @danah/react-hook-scrollto

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@danah/react-hook-scrollto) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@danah/react-hook-scrollto

React Hook to makes scrolling the document to the specified coordinates easy.

Installation

- yarn

yarn add react-hook-scrollto

- npm

npm i react-hook-scrollto

Usage

import React from "react";
import scrollTo from "@danah/react-hook-scrollto";

function App() {
  scrollTo({
    x: 25,
    y: 10,
    id: "foo",
    smooth: true
  });

  return <h1 id="foo">Hello Hooks</h1>;
}

Arguments

Argument Type Description Required
x number Set the horizontal x position to scroll to no
y number Set the vertical y position to scroll to no
id string Set the ID of the ScrollArea we want to scroll no
smooth string If true, this will animate the scroll to be smooth. False will give an instant scroll. (defaults: false) no

Return

No return value