# nice-hooks-fn

> 监听页面滚动,指定的元素是否处于浏览器窗口视图内 > 浏览器api,IntersectionObserver不兼容IE

Latest version **0.0.9** (published 2022-09-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install nice-hooks-fn
pnpm add nice-hooks-fn
yarn add nice-hooks-fn
bun add nice-hooks-fn
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2022-09-22 |
| First published | 2022-09-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=12 |
| Dependencies | 4 |
| Unpacked size | 4.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | fengshangsheng |
| Maintainers | fengshangsheng |

## Links

- npm: https://www.npmjs.com/package/nice-hooks-fn
- Repository: https://github.com/fengshangsheng/nice-hooks-fn
- Homepage: https://github.com/fengshangsheng/nice-hooks-fn#readme
- Issues: https://github.com/fengshangsheng/nice-hooks-fn/issues
- npm.io page: https://npm.io/package/nice-hooks-fn

## Dependencies (4)

- [react](https://npm.io/package/react.md) ^18.2.0
- [rollup-plugin-cleaner](https://npm.io/package/rollup-plugin-cleaner.md) ^1.0.0
- [@rollup/plugin-typescript](https://npm.io/package/@rollup/plugin-typescript.md) ^8.5.0
- [rollup-plugin-node-resolve](https://npm.io/package/rollup-plugin-node-resolve.md) ^5.2.0

## Recent versions

- 0.0.9 (latest) — 2022-09-22
- 0.0.8 — 2022-09-22
- 0.0.7 — 2022-09-20
- 0.0.6 — 2022-09-20
- 0.0.5 — 2022-09-20
- 0.0.4 — 2022-09-20
- 0.0.3 — 2022-09-20
- 0.0.2 — 2022-09-20
- 0.0.1 — 2022-09-19

## README

### useIntersectionObserver()

监听页面滚动,指定的元素是否处于浏览器窗口视图内
> 浏览器api,IntersectionObserver不兼容IE

```javascript
function App() {
  const $ref = useRef();
  const inView = useIntersectionObserver($ref);
  return <div ref={$ref}>元素</div>
}
```

### usePages()

```javascript
function App() {
  const view = usePage({
    pageIdx: 1,
    pageSize: 3,
    allList: [1, 2, 3, 4, 5, 6, 7, 8, 9]
  });
  return <div>
    {view.map((item) => <span>{item}</span>)}
  </div>
}
```

---
_Source: https://npm.io/package/nice-hooks-fn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
