kleros/kleros-v2

View on GitHub
web/src/hooks/useScrollTop.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { useContext } from "react";
import { OverlayScrollContext } from "context/OverlayScrollContext";

export const useScrollTop = () => {
  const osInstanceRef = useContext(OverlayScrollContext);

  const scrollTop = () => {
    osInstanceRef?.current?.osInstance().elements().viewport.scroll({ top: 0 });
  };

  return scrollTop;
};