kripod / react-hooks

Essential set of React Hooks for convenient Web API consumption and state management.
MIT License
556 stars 24 forks source link

error Object(...) is not a function #268

Closed Wendenburg closed 3 years ago

Wendenburg commented 3 years ago

Description

using useSize I get the following error in a Typescript setup: Object(...) is not a function

Reproduction

const imageRef = useRef(null);
const [width, height] = useSize(imageRef);
return <img ref={imageRef} srcSet={`${src} 1x`} src={src} />;

Expected behavior

There should be no error

Actual behavior

adding the line with useSize results in the above error, without everything is working

Environment

Not sure if this works properly:

System:

React: 16.3.1, web-api-hooks: "^3.0.2",

Wendenburg commented 3 years ago

found my mistake, my bad, all good!

kripod commented 3 years ago

Thanks for closing this issue. I’m glad that you could fix it 😊