Skip to content

Commit

Permalink
docs: README Modify
Browse files Browse the repository at this point in the history
  • Loading branch information
imb96 committed Dec 27, 2023
1 parent 9359da5 commit 883012c
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,26 @@ You can give the user a choice and let them choose a value through scrolling.
```shell
npm i react-hook-scroll
```

### Example

```jsx
import { useState } from "react";
import { VirtualScroll } from "react-hook-scroll";

function App() {
const [selected, setSelected] = useState(null);

return (
<div className="App">
<VirtualScroll list={[1, 2, 3, 4, 5]} onItemSelected={setSelected} />
</div>
);
}
```

![스크린샷 2023-12-27 오후 6 32 46](https://github.com/imb96/git-recipe/assets/71740032/4084c2a9-6d57-4631-a478-3b3cfc43d436)

List, onItemSelected is required props.
The 'list' is to hand over the array of lists that you want the user to choose.
In 'onItemSelected', you can add a function when the user selects an item.

0 comments on commit 883012c

Please sign in to comment.