After successfully rendering server-side pages and creating forms with react hooks for database updates, I encountered a challenge in integrating Ag-Grid into my application. Despite being able to retrieve data from the database using the mysql2 module and having it rendered in json format, I faced issues when attempting to pass this data to the client side (ag-grid) resulting in 'type' violations. My experience with Typescript has been challenging, but I am determined to overcome these obstacles.
I discovered that mysql provides two packet objects - a RowDataPacket containing the result set data in preformatted json, and a FieldPacket containing the column DDL of the result set. To streamline the process, I plan to create an api endpoint to serve the json data to the client side where I will utilize react hooks such as useState and useEffect to populate the ag-grid on the client-side. While this approach seems straightforward, I have encountered difficulties without the use of tools like Express, Axios, Prisma, or Vercel.
One potential solution could involve restructuring the received json data into a more usable format before serving it through the api. However, this method may require excessive effort and manipulation, potentially overloading the server. Despite exploring various discussions on the topic, finding a definitive answer has proved elusive thus far.
Any assistance or guidance on this matter would be greatly appreciated.