@am-hooks/use-scroll
Version:
Detect when using scroll
39 lines (28 loc) • 580 B
Markdown
스크롤 사용할 때 감지 <br><br>
`yarn add @am-hooks/use-scroll`
`npm i @am-hooks/use-scroll` <br><br>
```js
import React from "react";
import useScroll from "@am-hooks/use-scroll";
const App = () => {
const { y } = useScroll();
return (
<div className="App" style={{ height: "500vh" }}>
<h1
style={{
position: "fixed",
color: y > 100 ? "red" : "blue"
}}
>
Hello
</h1>
</div>
)
}
```
<br><br>