martink
PPrisma
•Created by martink on 11/28/2024 in #help-and-questions
Working with decimal in NextJS
Has anyone found a reasonable way to work with Decimal in NextJS?
"Only plain objects can be passed to Client Components from Server Components. Decimal objects are not supported."
Every time we add a Decimal to our schema, we end up breaking a bunch of server components. The only option seems to be manually serializing and deserializing everything, which isn't great.
Is there a way to tell NextJS or Prisma to serialize our Decimals as strings when sending to and from the client? Or are there other recommendations on how to work with decimals?
6 replies