hooks
hooks copied to clipboard
Support React v17
In a project I am working on which uses npm v7 (which automatically installs peer dependencies) and React 17, I am having trouble installing ahooks. Here is the error I get when I try to install it:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"^17.0.1" from the root project
npm ERR! peer react@"^16.8 || ^17.0" from @myproject/[email protected]
npm ERR! node_modules/@myproject/use-auth
npm ERR! @myproject/use-auth@"*" from the root project
npm ERR! 1 more (@myproject/use-request)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.6" from [email protected]
npm ERR! node_modules/ahooks
npm ERR! peer ahooks@"^2.9" from @myproject/[email protected]
npm ERR! node_modules/@myproject/use-auth
npm ERR! @myproject/use-auth@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/workspace/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/workspace/.npm/_logs/2021-02-19T14_58_28_334Z-debug.log
Please support React v17. I am happy to help if someone can point me in the right direction.
In another project which uses npm v6 and React v17, I get a warning about peer dependency version mismatch but the use-request hook worked as expected. Hopefully this issue will probably involve just updating the React version in peerDependencies.