0

I'm attempting to use the jotai-react-query library, and so I want to leverage

import {useHydrateAtoms} from "jotai/react/utils/useHydrateAtoms";

However when I'm building a test with jest, it cannot find the import. To verify, I created a blank app with:

npx create-react-app jest-example --template typescript

and added jotai

npm add jotai

and then added the import in App.tsx

import {useHydrateAtoms} from "jotai/react/utils/useHydrateAtoms";

plus a line to use it:

const y = useHydrateAtoms([])

and same as my project, the import fails:

Cannot find module 'jotai/react/utils/useHydrateAtoms' from 'src/App.test.tsx'

I've tried poking at some jest options in package.json, but I haven't found a combination that makes a difference.

PlexQ
  • 3,154
  • 2
  • 21
  • 26

0 Answers0