chapter one

1 Meeting React

 

This chapter covers

  • Understanding what React is
  • Solving problems with React
  • Fitting React into your web applications
  • Writing your first React app: Hello World

React is the ground-breaking tool that web developers may not even know they need, but can't let go of once they have tried it. This is definitely true for the two authors of this book, as well as for many other enthusiastic web developers out there. React is immensely popular and for good reason.

If you were doing web development in the early 2000s, all you needed was some HTML and a server-side language like Perl or PHP. Ah, the good old days of putting in alert() boxes just to debug your front-end code. The internet has evolved a lot since then, and the complexity of building websites has increased dramatically. Websites have become web applications with complex user interfaces, business logic, and data layers that require changes and updates over time—and often in real-time.

Many JavaScript template libraries have been written to try to solve the problems of dealing with complex user interfaces (UIs). But they still require developers to adhere to the old separation of concerns—which splits style (CSS), data and structure (HTML), and dynamic interactions (JavaScript)—and they don't meet modern-day needs (remember the term DHTML?).

1.1 Benefits of using React

1.1.1 Simplicity

1.1.2 Speed and testability

1.1.3 Ecosystem and community

1.2 Disadvantages of React

1.3 How React can fit into your website

1.3.1 Single-page applications and React

1.3.2 The React stack

1.4 Your first React app: Hello World

1.4.1 The result

1.4.2 Write the application

1.4.3 Install and run a web server

1.4.4 Go to local website

1.5 Quiz

1.6 Summary

1.7 Quiz answers