learning_react_1.pdf

(7364 KB) Pobierz
React
Learning
FUNCTIONAL WEB DEVELOPMENT WITH REACT AND REDUX
Alex Banks & Eve Porcello
Learning React
If you want to learn how to build efficient user interfaces with React, this is
your book. Authors Alex Banks and Eve Porcello show you how to create
UIs with this small JavaScript library that can deftly display data changes
on large-scale, data-driven websites without page reloads. Along the
way, you’ll learn how to work with functional programming and the latest
ECMAScript features.
Developed by Facebook, and used by companies including Netflix,
Walmart, and
The New York Times
for large parts of their web interfaces,
React is quickly growing in use. By learning how to build React components
with this hands-on guide, you’ll fully understand how useful React can be
in your organization.
Learning React takes the
functional programming
ideas behind React and
makes them accessible,
and immediately useful
for anyone who wants to
build modern JavaScript
applications. It's a great
guide to the common
challenges and solutions
associated with React
applications.
Software Engineer, Twitter and
author of
Learning React Native
Learn key functional programming concepts with JavaScript
Peek under the hood to understand how React runs in the browser
Create application presentation layers by mounting and
composing React components
Use component trees to manage data and reduce the time you
spend debugging applications
Explore React’s component lifecycle and use it to load data and
improve UI performance
Use a routing solution for browser history, bookmarks, and
other features of single-page applications
Learn how to structure React applications with servers in mind
—Bonnie Eisenman
Alex Banks
is a software engineer, instructor, and cofounder of Moon Highway,
a curriculum development company in California. He’s developed applications for
the Chicago Marathon, MSN, and the Department of Energy.
Eve Porcello
is a software architect, trainer, and cofounder of Moon Highway.
She also has taught JavaScript and Python at Stanford University, PayPal, eBay,
and Lynda.com.
JAVA SCRIPT
Twitter: @oreillymedia
facebook.com/oreilly
CAN $65.99
US $49.99
ISBN: 978-1-491-95462-1
Functional Web Development
with React and Redux
Learning React
Alex Banks and Eve Porcello
Beijing
Boston Farnham Sebastopol
Tokyo
Learning React
by Alex Banks and Eve Porcello
Copyright © 2017 Alex Banks and Eve Porcello. All rights reserved.
Printed in the United States of America.
Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472.
O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are
also available for most titles (http://oreilly.com/safari). For more information, contact our corporate/insti‐
tutional sales department: 800-998-9938 or
corporate@oreilly.com.
Editor:
Allyson MacDonald
Production Editor:
Melanie Yarbrough
Copyeditor:
Colleen Toporek
Proofreader:
Rachel Head
May 2017:
First Edition
Indexer:
WordCo Indexing Services
Interior Designer:
David Futato
Cover Designer:
Karen Montgomery
Illustrator:
Rebecca Demarest
Revision History for the First Edition
2017-04-26:
2018-02-09:
First Release
Second Release
See
http://oreilly.com/catalog/errata.csp?isbn=9781491954621
for release details.
The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.
Learning React,
the cover image, and
related trade dress are trademarks of O’Reilly Media, Inc.
While the publisher and the authors have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the authors disclaim all responsibility
for errors or omissions, including without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions contained in this work is at your own
risk. If any code samples or other technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your responsibility to ensure that your use
thereof complies with such licenses and/or rights.
978-1-491-95462-1
[LSI]
Table of Contents
Preface. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1.
Welcome to React. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Obstacles and Roadblocks
React Is a Library
New ECMAScript Syntax
Popularity of Functional JavaScript
JavaScript Tooling Fatigue
Why React Doesn’t Have to Be Hard to Learn
React’s Future
Keeping Up with the Changes
Working with the Files
File Repository
React Developer Tools
Installing Node.js
Declaring Variables in ES6
const
let
Template Strings
Default Parameters
Arrow Functions
Transpiling ES6
ES6 Objects and Arrays
Destructuring Assignment
Object Literal Enhancement
The Spread Operator
1
2
2
2
2
3
3
4
4
4
5
6
2.
Emerging JavaScript. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
10
10
10
12
13
14
17
19
19
20
22
iii
Zgłoś jeśli naruszono regulamin