Reflection on learning React
14 July 2023
Background
React was the next module after JavaScript that I completed for the Front-End Web Development course with Academy Xi. I found that learning React, which is a JavaScript library, extended my knowledge of JavaScript and opened up a different way of creating single-page applications. The topics included components, props, state, events, side effects, data fetching and client-side routing. I was able to apply these skills to create a React single-page application.
Learning journey
I found learning React difficult for quite a while, and I was adjusting to having less control as React does things behind the scenes compared to vanilla JavaScript. With time and especially through completing the project, I realized that React has advantages such as the use of components for reusable code. During the learning process, I understood some concepts quite quickly, but I needed several reviews of content to understand other concepts including props and the useState hook. I found that completing the summary assignments helped to consolidate my understanding of a topic. My learning process could have been improved by practising more, re-reading over content and watching video tutorials, and being compassionate with myself.
Some of my thoughts from the learning journey:
- Keep going, even when it seems like concepts are beyond reach. Practice and more practice will help those concepts to settle in.
- Look for other learning methods, including watching tutorials and reading books, to supplement learning.
- Complete small projects to practise the skills and then extend on those skills when comfortable.
Project
To create a React single-page application, I used a slightly different process to the process for my JavaScript project. Because I would be setting up my own data file (rather than using an external API), I started the project by brainstorming ideas for an application and then narrowing it down to a restaurant's website. I found images for inspiration and sketched out a plan for the components. I used Create React App to create the foundation of the application. To build the application, I used an incremental approach. I built the main page components, which were initially empty except for h1 elements, and applied some basic CSS styles. For the navigation bar, I added in client-side routing using React Router. I developed the booking form and booking card components. My general method to display the meals and desserts was to build smaller components with static data, apply basic CSS styles and then add in dynamic data. Once I was happy with the overall layout, I set up the GET request to the data file to display bookings and the POST request to submit bookings and save them to the data file. To complete the project, I polished the CSS styles.
A highly effective strategy for me to complete this project was to break big tasks/functionality into small manageable tasks and work steadily through the task list. This really helped me to manage the project. Also, I found it helpful to add in high-level CSS styles as I developed the components and then polish the CSS styles once the functionality of the application was complete. I think that the process of completing the project could have been improved by working through more exercises to practise the skills before starting the project.
Some of my thoughts from completing the project:
- Recognize when coding starts to become easier.
- Plan a logical process and work through it step-by-step, remembering that code can be changed if needed.
- React has benefits such as being able to create reusable blocks of code, but it also requires careful consideration and planning of application design.
Summary
Looking back over my React learning journey, I can see how I have progressed from my starting point of having no knowledge about React. I found the experience of combining my knowledge of HTML, CSS and JavaScript with the React library to create a React single-page application to be invaluable practice for applying these skills as well as using VS Code, Git and GitHub to complete the project. After my initial difficulty in learning to use React, I'm now excited to see how I can use React in future projects. I would like to re-create a website using React or complete more projects using React.
To see the GitHub repository of my React project, visit Cerulean Coast Restaurant.