-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.tsx
More file actions
31 lines (28 loc) · 855 Bytes
/
Copy pathmain.tsx
File metadata and controls
31 lines (28 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import React, { useEffect, useRef } from "react";
import ReactDOM from "react-dom/client";
import "./main.scss";
import Scrollbar from "./lib";
// import Scrollbar from "./dist/index.mjs";
function App() {
const scrollEle = useRef<HTMLDivElement>(null);
useEffect(() => {
// console.log("scrollEle: ", scrollEle);
// scrollEle.current!.scrollTop = 200;
}, []);
return (
<div className="box">
<Scrollbar wrapRef={scrollEle} style={{ width: 800, height: 500, background: "aliceblue" }}>
{new Array(20).fill(0).map((item, index) => (
<li key={index} style={{ width: 1000, height: 50 }}>
item {index + 1}
</li>
))}
</Scrollbar>
</div>
);
}
ReactDOM.createRoot(document.getElementById("root") as HTMLElement).render(
<React.Fragment>
<App />
</React.Fragment>
);