react-image: Module not found

Attempting to use the new useImage hook and cannot import

Module not found: Can't resolve 'react-image/useImage'

Also either the typings associated with useImage or the example in the README needs to be updated…TS is complaining imgPromise is required

import useImage from 'react-image/useImage'

export default function MyComponent() {
  const {src, isLoading, error} = useImage({
    srcList: 'https://www.example.com/foo.jpg',
  })

  return <img src={src} />
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 19 (12 by maintainers)

Most upvoted comments

Thanks for reporting! I see modules aren’t being exported as I had expected them to be.

Trying to figure out how to change this now, probably going to have to release another breaking change and remove the default export…