Glad you figured this out - and thanks for posting your solution. Best of luck with the rest of your project!
Topic summary
Deploying via npm run deploy began failing with “Cannot read properties of null (reading ‘useState’)”, with a stack trace pointing into @shopify/cli-kit’s React code (useState is a React state hook). The app had deployed fine until the prior week; npm run dev still worked but showed a punycode deprecation warning.
Tried fixes included updating packages and removing files, but the error persisted. No specific root cause was identified in the thread.
Resolution: Upgraded and switched to using the Shopify CLI directly with shopify app deploy instead of npm run deploy. After this change, deployment succeeded.
Outcome: Resolved. No additional steps, code changes, or configuration details were provided. The thread closed with acknowledgement and no open questions.