I’m attempting to use the Excalidraw library as a locally linked package in my React application. After setting up the package with yarn link
, I imported Excalidraw into my component:
import { Excalidraw } from "@excalidraw/excalidraw";
However, when I run my app, I get the following error:
Uncaught TypeError: Cannot read properties of null (reading 'useEffect') at useEffect (react.development.js:1634:1) at ExcalidrawBase (index.tsx:84:1) ...
I’ve ensured that both my app and the Excalidraw package are using React 18.3.1. The error seems related to mismatched React versions or an issue with how the package is built. I’ve also tried updating the build script to externalize React and ReactDOM, but the error persists.
What could be causing this useEffect
error, and how can I resolve it?