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 ...
Get React Programming: The Big Nerd Ranch Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.