Inserting into DB with prisma in api route

I have this very simple next api route f.ts, that just inserts a row into a table (the example table that comes with create-t3-app). I get the following error: TypeError: Cannot read properties of null (reading 'useContext') The server logs also mention: Warning: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem. I get that "Hooks can only be called inside the body of a function component". Then how do we use the trpc hook to insert into the DB outside a component ? Any guidance on how to insert into the DB from an api route would be appreciated thanks 🙏🙏🙏⭐⭐⭐
Rules of Hooks – React
The library for web and native user interfaces
No description
No description
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server