3 The other side of the equation: Building the Photosphere frontend
In this chapter, you will learn
- Refactoring to improve the design of our code
- Building a frontend with React and Parcel
- Creating multiple pages using React Router
- Connecting to the backend and uploading files with Axios
In the midst of the messy and complicated process of development, how do we produce code that is clean, simple and elegant?
An answer can be found in the practice known as refactoring. The surefire way to create clean and maintainable code is by adopting a practice of continuously refactoring our code while we are developing it. To this end, we need a development process that supports refactoring in a way that is both safe and sustainable.
Refactoring allows elegant design to emerge naturally through the ongoing evolution of our code.
Like any coding, refactoring is driven by feedback (sometimes self-generated, sometimes from our peers). We are constantly assessing our code and asking questions like this:
- Is it as simple as it can be?
- Is it easy enough to add new features?
- Are our code modules loosely coupled and sharing as little information as possible?
- Are there code smells we’d like to fix? (A code smell is an intuition that something isn’t quite right or could be better).