I made a few changes to my back-end as I worked as on my front-end. Some of the changes were explicitly in the assignment directions, like changing routes to begin with /api for Vite. I tweaked the GET books API handler to support substring searches for my front-end search bar using SQL's LIKE operator. I went back and fixed my Zod schemas from Homework 1, where I made publication year and genre for books required instead of optional, also adding more detailed error messages. If I could go back to HW1, I would've thought more carefully about my Zod schemas and put them in a separate file like I did with Homework 2 to make this homework easier.
Most of my validation is server-side. I have the front-end send the form data to the back-end using Axios, which can catch errors through my Zod schemas. It returns a 400 error and the front-end displays the error message to the user. The pros include that malicious users can't bypass validation (unlike with client-side validation) and it keeps the validation logic clean and in one place. The cons are that the feedback is slower since it requires a round trip to the server and increases server load. If I had went with client-side validation, the pros would be instant feedback for the user and saving server resources, but it's susceptible to malicious users like I mentioned before.
React is great, but I was super rusty. Understanding useEffect and useCallback was a bit of a pain. At first I didn't realize I was getting infinite rendering loops until I ran ESLint, which alerted me to them. I had to go back and read the page on fetching server data here, but even then I ran into some errors and had to give it a few rereads. I tried to figure out useCallback, but I opted instead to go with an IIFE. I enjoyed how easy it is to keep the UI in sync with the data, since the table automatically refreshes without me having to modify the DOM manually.
Back in 375, we used getElementById and manually added and removed elements. In 478, all we have to do is modify the state and React handles updating the DOM for me. I definitely prefer React. Even thought the setup itself is more complicated, it can handle complex user interactions and interfaces much cleaner and is less error-prone than event listeners and manual DOM manipulation.
It was a mix of helpful and annoying. It helped when I tried to access properties that didn't exist on the book or author objects, but it was also annoying for things like the error object (I just had ESLint ignore it). I didn't really struggle with typing that much - although it is a bit tedious, I'm already used to static typing from languages like Java, so it wasn't too bad.
I used Gemini like on the last homework to just help me write boilerplate code. It was also great for helping me with the CSS, which I find tedious more than anything else. It also helped teach me the useEffect stuff I struggled with earlier.
Definitely helped me save time. It works great for quick explanations or fixes when I hit a wall. I think it helped reinforce things I was learning about React already, but it may have indadvertently harmed my understanding of small things like CSS. I still took the time to understand what it's generating though to mitigate this.