Closed paul-vd closed 5 months ago
This allows to re-use the props for extracted logic
import { LogViewer, LogViewerProps } from "@patternfly/react-log-viewer"; const useScrollToRow = (logs: LogViewerProps["data"] = []) => { const [isUserScrolling, setIsUserScrolling] = useState(false); const onScroll:LogViewerProps["onScroll"] = (event) => { // 👈 here we can no get the event props without having to re-define them if (event.scrollOffsetToBottom < 30) { setIsUserScrolling(false); } else { setIsUserScrolling(true); } } return [ isUserScrolling ? undefined : logs.length - 1, onScroll, ] as const; };
:tada: This PR is included in version 5.2.0-prerelease.2 :tada:
The release is available on:
Your semantic-release bot :package::rocket:
What?
This allows to re-use the props for extracted logic
Example