React and APIs

Leo Yockey
Jul 23, 2017 · 3 min read

This week felt like Hell Week. I’ve just about finished my final Thinkful capstone, a full-functioning version of HospitAlert. After submitting my 2-week notice at work, I felt the pressure to finish my capstone in a timely matter so that I would have my portfolio and resume ready for my move. It was hard not to get overwhelmed.

One of the requirements for this capstone was to build the server-side API as a separate app. Once my API was complete, I ran into a lot of issues when I started making requests from the client. The project would have been a lot easier if the client and the API were part of the same app. But I definitely learned a lot more, including the nuances of cross-origin requests. It also confirmed my interest in backend development over frontend development, as building the API was really cool.

For the React client, I decided to use Redux, since I had some difficulties learning it. Now that I’ve gotten some more experience with Redux, I love it! I applied middleware to the store that pulls the initial state from local storage, if it’s there. That way, the state persists even after the page reloads. Due to Facebook’s cross-origin restrictions, Facebook OAuth is done on the client-side and then sent to the API via a POST request. The state is setup in a way to keep API requests minimal.

I still have to write some of the client-side tests, which are proving to be difficult due to the API requests in my components and reducers. But I think it’s safe to say that the hardest part is over. One night, I stumbled upon an old tweet of mine that put things in perspective.

A little over a month ago, I knew nothing about React. Now, I have a full-stack React app in my portfolio. And that’s pretty amazing. It was particularly difficult to stay motivated this week. Work has been hectic and I logged long hours coding in the evening. The payout will be worth it. This week will be my last week at the Golden Nugget. Then, a week later, I’ll be moving to LA!

Thanks for reading!