Type which translate model to JS type for inertia #4773
Unanswered
shankiflang
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys,
I use inertia-react as a frontend and need to pass data from the backend. I was wondering what was the best way to serialize the data before Inertia serializes it in its own way. I currently have a
toJSON()
on each of my models that translate. I don't know if it's possible to create a type that reads the model and creates a type that can be passed to Inertia. I'm trying to find a way of automating this operation, as I don't want to multiply the definitions of the same resource.Example of my model :
If anyone has a better approach, I'd love to hear about it!
Beta Was this translation helpful? Give feedback.
All reactions