WebDevSimplified / useful-custom-react-hooks

1.95k stars 687 forks source link

Update useSize.js #27

Open tjcchen opened 1 year ago

tjcchen commented 1 year ago

Hello Kelly, thanks much for such great sharing. I notice this line of import in custom useSize hook.

import { useEffect } from "react/cjs/react.development"

Is this import intended or just a typo or something. I found in newer react versions, this line of code cast errors in my place.

Could we just use the useEffect hook from react directly.

Thanks

Yasin-97 commented 7 months ago

It may cause issues because it directly references the internal development build of React. Instead, you can use the useEffect hook directly from React itself.

tjcchen commented 6 months ago

@Yasin-97 Yep, that's the reason why I pull this request. Hoping the author can merge my request.