6 Effects and the React component life cycle

This chapter covers

  • Running effects inside components
  • A complete guide to the React component life cycle
  • Mounting, unmounting, and rendering components
  • Introducing life cycle methods for class-based components

React components use JavaScript XML (JSX) to send information to the user in the form of HTML. But components need to do a lot more than that to be useful in an application. In React, everything that happens, happens in some component, so if your application wants to set a cookie, load some data, handle form input, display the user’s camera, start or stop a timer, or a myriad of other dynamic capabilities, you need more than just JSX.

If you want your component to load some data from a server, ...

Get React Quickly, Second Edition 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.