React 18 causing invalid hook call error, downgrading to React 17 and wiping node_modules resolves issue
33 replies
Last updated: Jun 3, 2022
AI Update
I understand you're having issues with Sanity! Since "freaking out" could mean a lot of different things, let me help you troubleshoot. Here are the most common issues and how to fix them:
If Studio won't start or crashes:
- Check that you're using Node.js 20+ (Studio v4 requires this)
- Try deleting
node_modulesand.sanityfolders, then runnpm installagain - Clear your browser cache and try in an incognito window
- Check the browser console (F12) for specific error messages
If you're seeing API or query errors:
- Recent API changes (v2025-02-19) changed the default perspective to
publishedinstead ofraw- this might affect what content you see - If using TypeScript, queries now need the
defineQuerywrapper for type generation - Check your CORS settings in your project's API settings if you're getting CORS errors
If content isn't appearing or syncing:
- Make sure documents are actually published (not just drafts)
- Check if you're using the correct dataset name
- Verify your API token has the right permissions if using one
If you're using Next.js 15:
- Route params are now Promises - you need to
await params.sluginstead of accessingparams.slugdirectly
To get specific help:
- Check the browser console and terminal for error messages - they usually point to the exact issue
- Post in the Sanity Community Slack with the specific error message
- Share your error details on the Sanity GitHub discussions
If you can share the specific error message you're seeing (from the console or terminal), I can give you much more targeted help! What exactly is happening when Sanity "freaks out"?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.