react-hooks-global-scrollspy
Version:
React Hook for managing navigation by scroll position
15 lines (14 loc) • 482 B
JavaScript
import { createContext } from "react";
/**
* Context provides a way to pass DOM element activated and
* Actions are used to control registered DOM elements
* through the component tree without having to pass props down manually at every level.
*/
export var GlobalScrollSpyContext = createContext({
activeElement: null,
actions: {
registerElement: function (_) { },
unregisterElement: function (_) { },
resetElements: function () { },
},
});