web
web copied to clipboard
use-raf hook: animation hook for react using requestAnimationFrame
What new hook does?
Checklist
- [x] Have you read contribution guideline?
- [x] Does the code have comments in hard-to-understand areas?
- [ ] Is there an existing issue for this PR?
- [x] Have the files been linted and formatted?
- [x] Have the docs been updated?
- [x] Have the tests been added to cover new hook?
- NOTE: need more tests
- [x] Have you run the tests locally to confirm they pass?
Few questions:
- I am not really good with Jest, need to add more tests. please suggest new tests and approaches.
- I was referring react-use test cases for useRaf, it uses raf-stub which is written in JS. so couldn't use it in tests as types are not available for it
any plan to merge this?
i have several notices on implementation, but I'm ill ATM, will do the review later.
I was referring react-use test cases for useRaf, it uses raf-stub which is written in JS. so couldn't use it in tests as types are not available for it
Tests don't require raf-stub since Jest provides pretty much all needed functionality, see https://github.com/react-hookz/web/blob/master/src/useRafCallback/tests/dom.ts
Please consider https://github.com/streamich/react-use/pull/2215