donavon / use-dark-mode

A custom React Hook to help you implement a "dark mode" component.
MIT License
1.29k stars 98 forks source link

Added react@^17.0.0 as a peer dependency #68

Open gragland opened 3 years ago

gragland commented 3 years ago

This PR adds react@^17.0.0 as a peer dependency in order to avoid warnings on projects that use latest versions of React.

lukasoppermann commented 2 years ago

Please merge this @donavon as it produces errors

joyfulelement commented 2 years ago

Hi, while react v18 release is already on horizon in the coming year, curious when this PR can be merged to at least support react v17.x.x? When I try to npm install (npm version: 8.1.2 from LTS version of Node), the following error will be produced.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: 
npm ERR! Found: react@17.0.2
npm ERR! node_modules/react
npm ERR!   react@"17.0.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from use-dark-mode@2.3.1
npm ERR! node_modules/use-dark-mode
npm ERR!   use-dark-mode@"2.3.1" 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.

Thanks!

SevenOutman commented 2 years ago

ping @donavon

transitive-bullshit commented 2 years ago

I would recommend using this instead as it will work with any future react versions:

  "peerDependencies": {
    "react": ">=16"
  },
transitive-bullshit commented 2 years ago

Until this gets merged, if anyone wants a workaround, you can use @fisch0920/use-dark-mode from my fork here https://github.com/transitive-bullshit/use-dark-mode

It will work with React 17 and 18.

pranaynailwal commented 1 year ago

Any updates on this?