A collection of general purpose, side-effect free, hooks that can be used in React apps. It is tested with React and React Native.
This targets React 18 to make it work with Expo 47.
Originally this was React Hook Tests which is a bunch of hooks I wrote to learn how to use React hooks and have associated jest tests with it and attempt to get a good test coverage.
These are fixable using --fix
- arrow-body-style
- curly
- eqeqeq
- logical-assignment-operators
- multiline-comment-style
- no-floating-decimal
- prefer-arrow-callback since the naming is done automatically by babel
- prefer-const
- "prefer-numeric-literals": "error",
- "prefer-object-spread": "error",
- "prefer-template": "error",
- "yoda": "error",
- @typescript-eslint/ban-types is ignored becaues React uses
{}
as the prop type default.
Instead of Ramda and Rambda? debounce
is only implemented in Lodash.
This project used Yarn earlier. However, it has changed to npm again. Reasons:
- Facebook still uses Yarn 1 over Yarn Berry so seems like a contention there.
- Since this this a stand alone project, I'd rather reduce the complexity of the setup. For my monorepo that is using this Yarn works with it.
npm
is installed with NodeJSnpm
has workspace support as well.npm
has stricter semver checks.
The 2020 article on Yarn 1 vs Yarn 2 vs NPM gives a bit of insights and priorities though my order is slightly different
- Broad support — needs to work with React Native, Node CLIs, web — anything we do. We work with a number of clients over a range of technologies and having a package manager that can be used for all our
JavaScriptTypeScript technologies is a must-have - Predictability — will install the same packages every time. Having different versions on different machines makes debugging quite difficult
- Reliability — it’s not flaky nor does it fail randomly. Nothing seems to frustrate developers as fast as flaky tools
- Speed — lowered the priority because I prefer predictability and reliability over speed.
- Caching — local installs wherever possible. We all work remotely and so less network traffic/bandwidth is critical
- Community adoption
- Cost of change
- Key value-added features