Hacking with React - GitHub

 Hacking with React

Get started with React, React Router, Jest, Webpack, ES6 and more with this hands-on guide.

Paul Hudson

? 2016 Paul Hudson

This book is dedicated to my wife, who has been endlessly patient with me while I write and re-write this book. No matter how hard I work, she works just as hard and has always been there for me.

CONTENTS

Contents

Welcome! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Begin at the Beginning: Chapter One . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 The Importance of using Webpack with React . . . . . . . . . . . . . . . . . . . . . . . . . 9 Introduction to JSX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Importing React Components using ES6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 What are React Props? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Generating Random Values for Our Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 How to Write if/else Conditional Statements in JSX . . . . . . . . . . . . . . . . . . . . . 20 Using JSX to Render Several Elements at Once . . . . . . . . . . . . . . . . . . . . . . . . 23 Handling Events with JSX: onClick . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 State vs Props in React . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 Changing a React Component's State with setState() . . . . . . . . . . . . . . . . . . . . . 30 State and the Single Source of Truth . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Rendering an Array of Data with map() and JSX . . . . . . . . . . . . . . . . . . . . . . . 33 Cleaning up and Preparing for a Real Project . . . . . . . . . . . . . . . . . . . . . . . . . 37 Fetching Ajax Data from GitHub using SuperAgent . . . . . . . . . . . . . . . . . . . . . . 40 Converting GitHub's JSON into Meaningful JSX . . . . . . . . . . . . . . . . . . . . . . . 42 Time for a Task: Reading from Three Feeds . . . . . . . . . . . . . . . . . . . . . . . . . . 45 How to Upgrade Our App to Read Three Feeds . . . . . . . . . . . . . . . . . . . . . . . . 46 Refactoring our Ajax Code: Don't Repeat Yourself . . . . . . . . . . . . . . . . . . . . . . 53



@twostraws

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download