Introduction
React.js (or just React, as it’s also called and as it’ll be referred to for the majority of this book) is one of the most popular frontend JavaScript libraries – maybe even the most popular one, according to a 2023 Stack Overflow developer survey. It is currently used by over 5% of the top 1,000 websites and compared to other popular frontend JavaScript libraries and frameworks like Angular, React is leading by a huge margin, when looking at key metrics like weekly package downloads via npm, which is a tool commonly used for downloading and managing JavaScript packages.
Though it is certainly possible to write good React code without fully understanding how React works and why you’re using it, you’ll likely be able to learn advanced concepts quicker and avoid errors when trying to understand the tools you’re working with as well as the reasons for picking a certain tool in the first place.
Therefore, before considering anything about its core concepts and ideas or reviewing example code, you first need to understand what React actually is and why it exists. This will help you understand how React works internally and why it offers the features it does.
If you already know why you’re using React, why solutions like React, in general, are being used instead of vanilla JavaScript (i.e., JavaScript without any frameworks or libraries, more on this in the next section), and what the idea behind React and its syntax is, you may, of course, skip this section and jump ahead to the more practice-oriented chapters later in this book.
But if you only think that you know it and are not 100% certain, you should definitely read this chapter first.