CJY0208 / react-activation

Hack <KeepAlive /> for React
https://www.npmjs.com/package/react-activation
MIT License
1.81k stars 141 forks source link

Remove dependency on `create-react-context` #230

Open isc30 opened 2 years ago

isc30 commented 2 years ago

Hey, really useful library!

I noticed it uses create-react-context as a dependency, and create-react-context only supports up to react: ^16.0.0. Do you think it's possible to remove that dependency and use the normal 'createContext` from React?

CJY0208 commented 2 years ago

is there any problem right now?

create-react-context is used between versions 16.0.0 and 16.3.0 to support React.createContext which is only supported on 16.3.0, it works as follows

image

isc30 commented 2 years ago

yeah, as it's marked a direct dependency instead of optional dependency, PNPM warns when using React18 as it's not supported by create-react-context.

I think making it an optional dependency could solve it

El mar., 11 oct. 2022 3:50, CJY @.***> escribió:

is there any problem right now?

create-react-context is used between versions 16.0.0 and 16.3.0 to support React.createContext which is only supported on 16.3.0, it works as follows

  • between versions 16.0.0 and 16.3.0: use implementation methods of itself
  • ^16.3.0: use React.createContext directilly

[image: image] https://user-images.githubusercontent.com/18415774/194979137-3c436313-5e09-4fbd-b19b-befd2dcd5a23.png

— Reply to this email directly, view it on GitHub https://github.com/CJY0208/react-activation/issues/230#issuecomment-1273984080, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACSOOCZOUMSMUSYHKJQHUP3WCTBVNANCNFSM6AAAAAARBND4HI . You are receiving this because you authored the thread.Message ID: @.***>