Chapter 2. Components
Ottergram is looking good! But imagine trying to maintain it as it becomes popular and the user count skyrockets.
At the moment, each element is hardcoded into
App.js. Although this works, and the elements render to the screen just fine, it does lead to a lot of repeated code.
If Ottergram were an enterprise application, it could have hundreds or thousands of users who all want to share their photos. You would need to add each post individually to the JSX (which, recall, is what your code that looks like HTML really is). This would quickly become unsustainable.
Thankfully, there is a better way.
In this chapter, you will learn about creating and working with components. By the end of the chapter, you will have moved the ...