Learning React
What a journey, what an experience! I've just completed my final module project, which includes a Rails API with a React client. I'm also using a PostgreSQL database. I was challenged to use three routes and 5 stateless components. I chose one of my favorite subject matters: comic book superheroes. This app was so fun to make!
I was allowed to generate the initial kernel of my app using create-react-app, which freed up a lot of my time to research and structure the project. I paired my front end with Redux to manage my global state. Redux gives you the ability to store information from your back end in your client so that it doesn't need to keep making requests to the API. Which is not only great for the efficiency of your app, but incredibly useful in the development phase when you are likely to make many requests. I was also introduced to middleware called Thunk. Thunk allows us to dispatch actions to our reducer only when it has received data from the API in an asynchronous fashion. It's like a silent super-power!
I had some trouble making my reducer efficient as the information I would receive from different requests was so dense and nested. It was such a fun challenge. It’s always better practice to keep your state as flat as possible, so as not to deal with the issue of nested data. However, in my situation, I needed the entire object returned so that I could peel through it in my components and pass them down as props. I will make better plans when creating my next project.
These last 10 months of my life have been among the most challenging. But I have also had some of the most rewarding experiences while learning to code and develop websites. This experience has given me the confidence to pursue a career as a software engineer, as well as the skills to contribute thoughtfully on day one. I'll paraphrase Bill Gates and say: everyone should learn to code. Coding teaches you to break problems down into more digestible chunks so that we can solve them more efficiently. Looking forward to my next project!