Cannot get React component installed from npm to work in Custom UI

I created a Forge Custom UI project with a Global page. I followed the tutorial, and everything worked fine. I then added a React component that was installed from NPM (react-accessible-tree). I referenced it in the App.js and it failed to display the React component. I rebuilt the app several times and received a couple of different errors. What am I missing here?

react.production.min.js:24 Uncaught TypeError: Cannot read properties of null (reading 'useContext')
react.production.min.js:26 Uncaught TypeError: Cannot read properties of null (reading 'useRef')

Hey @ebrunojam, I suspect this is due to conflicting react dependencies in your node modules. Where did you add the react-accessible-tree dependency? Was it in VB/package.json or was it in VB/static/hello-world/package.json?

VB/node_modules should not contain frontend dependencies used by your app’s resource, so if you’ve installed any there you need to move them into static/hello-world, delete your node_modules folders, and reinstall the dependencies.


Wow. What a rookie mistake. You were spot on. Looking forward to doing a lot more Forge development. Thanks!