learning-react
The code samples for Learning React by Alex Banks and Eve Porcello, published by O'Reilly Media
The official code samples for the O'Reilly book 'Learning React' by Alex Banks and Eve Porcello, organized chapter by chapter so readers can run and experiment with every example from components and state through Redux and testing.
This repository holds all the code samples that go along with the book "Learning React" by Alex Banks and Eve Porcello, published by O'Reilly Media. If you bought the book and want to follow along with working examples, this is where you find them organized by chapter.
React is a JavaScript library for building user interfaces, and the book targets people who are curious about React but are not sure where to begin. The chapters walk through foundational JavaScript concepts first, then move into React-specific topics like components, props, state, routing, and server rendering. Later chapters cover Redux, which is a common tool for managing data across a React application, along with testing.
The repo is organized into folders for each of the book's twelve chapters. Each folder contains the runnable code for that part of the book. The repo notes that it has been updated to React 16, which is a newer version than the one used in the printed book. If you have the physical book and want the code to match exactly what is printed, an older tagged version of the repo (v1.0.0) is available for that purpose. The README files inside the individual chapter folders explain where the React 16 changes affect the examples.
This is a companion resource to a published book, not a standalone tool or library. Its value is in giving readers code they can run, experiment with, and compare to what they read on the page.
Where it fits
- Follow along chapter by chapter with runnable code while reading 'Learning React' so you can see each concept working in your browser.
- Experiment with the Redux chapter samples to understand how state flows through a multi-component React app before applying it to your own project.
- Use the React 16 updated code to compare against the older book examples and understand what changed between versions.
- Run the testing chapter examples to learn how to write unit tests for React components using the patterns shown in the book.