100% found this document useful (1 vote)
11 views

Learning React: Modern Patterns for Developing React Apps, 2nd Edition (eBook PDF) instant download

The document promotes the eBook 'Learning React: Modern Patterns for Developing React Apps, 2nd Edition' by Alex Banks and Eve Porcello, which aims to teach developers the React library and modern JavaScript techniques. It covers essential topics such as state management, React Router, testing, and server rendering, while assuming no prior knowledge of React. The book also emphasizes the importance of being comfortable with HTML, CSS, and JavaScript before diving into React development.

Uploaded by

yzcnkcsrk537
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
11 views

Learning React: Modern Patterns for Developing React Apps, 2nd Edition (eBook PDF) instant download

The document promotes the eBook 'Learning React: Modern Patterns for Developing React Apps, 2nd Edition' by Alex Banks and Eve Porcello, which aims to teach developers the React library and modern JavaScript techniques. It covers essential topics such as state management, React Router, testing, and server rendering, while assuming no prior knowledge of React. The book also emphasizes the importance of being comfortable with HTML, CSS, and JavaScript before diving into React development.

Uploaded by

yzcnkcsrk537
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Learning React: Modern Patterns for Developing

React Apps, 2nd Edition (eBook PDF) download

https://ebookluna.com/product/learning-react-modern-patterns-for-
developing-react-apps-2nd-edition-ebook-pdf/

Download full version ebook from https://ebookluna.com


We believe these products will be a great fit for you. Click
the link to download now, or visit ebookluna.com
to discover even more!

Learning React: Modern Patterns for Developing React Apps, 2nd Edition
(eBook PDF)

https://ebookluna.com/product/learning-react-modern-patterns-for-
developing-react-apps-2nd-edition-ebook-pdf/

(eBook PDF) Instructional Patterns: Strategies for Maximizing Student


Learning

https://ebookluna.com/product/ebook-pdf-instructional-patterns-strategies-
for-maximizing-student-learning/

(eBook PDF) Reflections: Patterns for Reading and Writing 2nd Edition

https://ebookluna.com/product/ebook-pdf-reflections-patterns-for-reading-
and-writing-2nd-edition/

(eBook PDF) Patterns of Modern Chinese History by Charles A. Desnoyers

https://ebookluna.com/product/ebook-pdf-patterns-of-modern-chinese-history-
by-charles-a-desnoyers/
Modern Sample Preparation for Chromatography, 2nd Edition Serban Moldoveanu
- eBook PDF

https://ebookluna.com/download/modern-sample-preparation-for-
chromatography-2nd-edition-ebook-pdf/

(Original PDF) Learning for Teaching, Teaching for Learning with Student
Resour

https://ebookluna.com/product/original-pdf-learning-for-teaching-teaching-
for-learning-with-student-resour/

(eBook PDF) Developing Content Area Literacy: 40 Strategies for Middle and
Secondary Classrooms 2nd Edition

https://ebookluna.com/product/ebook-pdf-developing-content-area-
literacy-40-strategies-for-middle-and-secondary-classrooms-2nd-edition/

Business Communication: Developing Leaders for a Networked World 2nd


Edition Peter W. Cardon - eBook PDF

https://ebookluna.com/download/business-communication-developing-leaders-
for-a-networked-world-ebook-pdf/

(eBook PDF) Patterns of World History Combined Volume 2nd edition

https://ebookluna.com/product/ebook-pdf-patterns-of-world-history-combined-
volume-2nd-edition/
c. Typechecking for React Applications
i. PropTypes
ii. Flow
iii. TypeScript
d. Test-Driven Development
i. TDD and Learning
e. Incorporating Jest

i. Create React App and Testing


f. Testing React Components
i. Queries
ii. Testing Events
iii. Using Code Coverage
12. 11. React Router
a. Incorporating the Router
b. Router Properties
i. Nesting Routes
c. Using Redirects
i. Routing Parameters
13. 12. React and the Server
a. Isomorphic Versus Universal
i. Client and Server Domains
b. Server Rendering React
c. Server Rendering with Next.js
d. Gatsby
e. React in the Future
14. Index
Learning React
SECOND EDITION

Modern Patterns for Developing React Apps

Alex Banks and Eve Porcello


Learning React

by Alex Banks and Eve Porcello

Copyright © 2020 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). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
[email protected].

Acquisitions Editor: Jennifer Pollock

Development Editor: Angela Rufino

Production Editor: Kristen Brown

Copyeditor: Holly Bauer Forsyth

Proofreader: Abby Wheeler

Indexer: Judith McConville

Interior Designer: David Futato

Cover Designer: Karen Montgomery


Illustrator: Rebecca Demarest

May 2017: First Edition


June 2020: Second Edition
Revision History for the Second Edition
2020-06-12: First Release

See http://oreilly.com/catalog/errata.csp?isbn=9781492051725 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.

The views expressed in this work are those of the authors, and do not
represent the publisher’s views. 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-492-05172-5
[LSI]
Preface

This book is for developers who want to learn the React library while
learning the latest techniques currently emerging in the JavaScript
language. This is an exciting time to be a JavaScript developer. The
ecosystem is exploding with new tools, syntax, and best practices that
promise to solve many of our development problems. Our aim with this
book is to organize these techniques so you can get to work with React
right away. We’ll get into state management, React Router, testing, and
server rendering, so we promise not to introduce only the basics and
then throw you to the wolves.

This book does not assume any knowledge of React at all. We’ll
introduce all of React’s basics from scratch. Similarly, we won’t
assume that you’ve worked with the latest JavaScript syntax. This will
be introduced in Chapter 2 as a foundation for the rest of the chapters.

You’ll be better prepared for the contents of the book if you’re


comfortable with HTML, CSS, and JavaScript. It’s almost always best
to be comfortable with these big three before diving into a JavaScript
library.

Along the way, check out the GitHub repository. All of the examples
are there and will allow you to practice hands-on.

Conventions Used in This Book


The following typographical conventions are used in this book:

Italic
Indicates new terms, URLs, email addresses, filenames, and file
extensions.

Constant width
Used for program listings, as well as within paragraphs to refer to
program elements such as variable or function names, databases,
data types, environment variables, statements, and keywords.

Constant width bold


Shows commands or other text that should be typed literally by the
user.

TIP
This element signifies a tip or suggestion.

NOTE
This element signifies a general note.

WARNING
This element indicates a warning or caution.
Using Code Examples
Supplemental material (code examples, exercises, etc.) is available for
download at https://github.com/moonhighway/learning-react.

If you have a technical question or a problem using the code examples,


please send email to [email protected].

This book is here to help you get your job done. In general, if example
code is offered with this book, you may use it in your programs and
documentation. You do not need to contact us for permission unless
you’re reproducing a significant portion of the code. For example,
writing a program that uses several chunks of code from this book does
not require permission. Selling or distributing examples from O’Reilly
books does require permission. Answering a question by citing this
book and quoting example code does not require permission.
Incorporating a significant amount of example code from this book into
your product’s documentation does require permission.

We appreciate, but generally do not require, attribution. An attribution


usually includes the title, author, publisher, and ISBN. For example:
“Learning React by Alex Banks and Eve Porcello (O’Reilly).
Copyright 2020 Alex Banks and Eve Porcello, 978-1-492-05172-5.”

If you feel your use of code examples falls outside fair use or the
permission given above, feel free to contact us at
[email protected].

O’Reilly Online Learning


NOTE
For more than 40 years, O’Reilly Media has provided technology and business
training, knowledge, and insight to help companies succeed.

Our unique network of experts and innovators share their knowledge


and expertise through books, articles, and our online learning platform.
O’Reilly’s online learning platform gives you on-demand access to live
training courses, in-depth learning paths, interactive coding
environments, and a vast collection of text and video from O’Reilly
and 200+ other publishers. For more information, visit
http://oreilly.com.

How to Contact Us
Please address comments and questions concerning this book to the
publisher:

O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

800-998-9938 (in the United States or Canada)

707-829-0515 (international or local)

707-829-0104 (fax)

We have a web page for this book, where we list errata, examples, and
any additional information. You can access this page at
https://oreil.ly/learningReact_2e.

Email [email protected] to comment or ask technical


questions about this book.

For news and information about our books and courses, visit
http://oreilly.com.

Find us on Facebook: http://facebook.com/oreilly

Follow us on Twitter: http://twitter.com/oreillymedia

Watch us on YouTube: http://www.youtube.com/oreillymedia

Acknowledgments
Our journey with React wouldn’t have started without some good old-
fashioned luck. We used YUI when we created the training materials
for the full-stack JavaScript program we taught internally at Yahoo.
Then in August 2014, development on YUI ended. We had to change
all our course files, but to what? What were we supposed to use on the
front-end now? The answer: React. We didn’t fall in love with React
immediately; it took us a couple hours to get hooked. It looked like
React could potentially change everything. We got in early and got
really lucky.

We appreciate the help of Angela Rufino and Jennifer Pollock for all
the support in developing this second edition. We also want to
acknowledge Ally MacDonald for all her editing help in the first
edition. We’re grateful to our tech reviewers, Scott Iwako, Adam
Rackis, Brian Sletten, Max Firtman, and Chetan Karande.

There’s also no way this book could have existed without Sharon
Adams and Marilyn Messineo. They conspired to purchase Alex’s first
computer, a Tandy TRS 80 Color Computer. It also wouldn’t have
made it to book form without the love, support, and encouragement of
Jim and Lorri Porcello and Mike and Sharon Adams.

We’d also like to acknowledge Coffee Connexion in Tahoe City,


California, for giving us the coffee we needed to finish this book, and
its owner, Robin, who gave us the timeless advice: “A book on
programming? Sounds boring!”
Chapter 1. Welcome to React

What makes a JavaScript library good? Is it the number of stars on


GitHub? The number of downloads on npm? Is the number of tweets
that ThoughtLeaders™ write about it on a daily basis important? How
do we pick the best tool to use to build the best thing? How do we
know it’s worth our time? How do we know it’s good?

When React was first released, there was a lot of conversation around
whether it was good, and there were many skeptics. It was new, and the
new can often be upsetting.

To respond to these critiques, Pete Hunt from the React team wrote an
article called “Why React?” that recommended that you “give it
[React] five minutes.” He wanted to encourage people to work with
React first before thinking that the team’s approach was too wild.

Yes, React is a small library that doesn’t come with everything you
might need out of the box to build your application. Give it five
minutes.

Yes, in React, you write code that looks like HTML right in your
JavaScript code. And yes, those tags require preprocessing to run in a
browser. And you’ll probably need a build tool like webpack for that.
Give it five minutes.

As React approaches a decade of use, a lot of teams decided that it’s


good because they gave it five minutes. We’re talking Uber, Twitter,
Airbnb, and Twitter—huge companies that tried React and realized that
it could help teams build better products faster. At the end of the day,
isn’t that what we’re all here for? Not for the tweets. Not for the stars.
Not for the downloads. We’re here to build cool stuff with tools that
we like to use. We’re here for the glory of shipping stuff that we’re
proud to say we built. If you like doing those types of things, you’ll
probably like working with React.

A Strong Foundation
Whether you’re brand new to React or looking to this text to learn
some of the latest features, we want this book to serve as a strong
foundation for all your future work with the library. The goal of this
book is to avoid confusion in the learning process by putting things in a
sequence: a learning roadmap.

Before digging into React, it’s important to know JavaScript. Not all of
JavaScript, not every pattern, but having a comfort with arrays, objects,
and functions before jumping into this book will be useful.

In the next chapter, we’ll look at newer JavaScript syntax to get you
acquainted with the latest JavaScript features, especially those that are
frequently used with React. Then we’ll give an introduction to
functional JavaScript so you can understand the paradigm that gave
birth to React. A nice side effect of working with React is that it can
make you a stronger JavaScript developer by promoting patterns that
are readable, reusable, and testable. Sort of like a gentle, helpful
brainwashing.
From there, we’ll cover foundational React knowledge to understand
how to build out a user interface with components. Then we’ll learn to
compose these components and add logic with props and state. We’ll
cover React Hooks, which allow us to reuse stateful logic between
components.

Once the basics are in place, we’ll build a new application that allows
users to add, edit, and delete colors. We’ll learn how Hooks and
Suspense can help us with data fetching. Throughout the construction
of that app, we’ll introduce a variety of tools from the broader React
ecosystem that are used to handle common concerns like routing,
testing, and server-side rendering.

We hope to get you up to speed with the React ecosystem faster by


approaching it this way—not just to scratch the surface, but to equip
you with the tools and skills necessary to build real-world React
applications.

React’s Past and Future


React was first created by Jordan Walke, a software engineer at
Facebook. It was incorporated into Facebook’s newsfeed in 2011 and
later on Instagram when it was acquired by Facebook in 2012. At
JSConf 2013, React was made open source, and it joined the crowded
category of UI libraries like jQuery, Angular, Dojo, Meteor, and others.
At that time, React was described as “the V in MVC.” In other words,
React components acted as the view layer or the user interface for your
JavaScript applications.
Another Random Scribd Document
with Unrelated Content
found out that Uncle Sam has covered himself with glory, and now
he wants Phil and me to see the bird from beak to claws—the whole
American Eagle.”
“But sha’n’t we have trouble about tickets?” asked Mr. Douglass.
“No,” said Harry. “Father’s a railroad man. That’s what ‘See Farwell’
means. You let me go to see him. He’s the general manager, or
some high-cockalorum. He’ll see us through by daylight.”
“Very well,” said Mr. Douglass, “I’m just as glad to go as you are.
Philip and I will attend to the packing, and you shall go to New York
this afternoon and see Mr. Farwell. Now you can tell Philip about it.”

AND LIBERAL ARTS BUILDING.

Harry ran out of the room, slamming the door behind him, but Mr.
Douglass only laughed. Perhaps he would have slammed it, too, if
he’d been in the boy’s place.
“Well?” said Philip, looking up from the Xenophon he was
translating.
“Thanks be to Christopher Columbus!” said Harry, with a jig-step.
“Has he done anything new?” Philip asked, looking over his
spectacles.
“I guess not,” said Harry, “but we’re going to the Fair.”
“How can we?” Philip asked.
Harry threw the cable despatch down upon the table, and turned
to get his hat. Philip read the telegram, carefully wiped his glasses,
rose, put the Xenophon into its place upon his book-shelves, and
said:
“Xenophon will have to attend to his own parasangs for a while.”
“You pack up for me, and I’ll see to the railroad-tickets,” said
Harry. “I have just about time to catch the train for New York.”
That was a hard and busy day for all three of the party. Perhaps
Harry’s share was the easiest, for, by showing his father’s despatch
to Mr. Farwell, he had everything made easy for him. Still, even
influence might not have secured them places except for the aid of
chance. It happened that a prominent man had, at the last moment,
to give up a section in the Wagner sleeper, and this was turned over
to Harry. So, late in the afternoon the boy came back with what he
called “three gilt-edged accordion-pleated tickets.”
Meanwhile Mr. Douglass and Philip had put into three traveling-
bags as much as six would hold, and the party went to bed early to
get a good rest before the long journey.
A WILDERNESS OF IRON.—BUILDING MACHINERY HALL.

Next day at nearly half-past four the three travelers walked


through the passageway at the Grand Central Depot, had their
tickets punched,—and Philip noticed that the man at the gate kept
tally on a printed list of the numbers of different tickets presented,—
and entered the mahogany and blue-plush Wagner cars.
In a few minutes some one said quietly: “All right,” and the train
gently moved out.
“I can remember,” said Mr. Douglass, “when a train started with a
shock like a Japanese earthquake. Now this seemed to glide out as if
saying, ‘Oh, by the way, I think I’ll go to Chicago!’”
Harry laughed. “Yes,” he said, “and how little fuss there is about it.
Why, abroad, I remember that they had first a bell, then a yell, then
a scream, then the steam!”
As the train passed through the long tunnel just after leaving the
station, Mr. Douglass remarked:
“How monotonous those dark arches of brickwork are!”
“Yes,” said Philip, “they should have a set of frescos put in them.”
“But no one could see the pictures,” said Mr. Douglass, “we pass
them so fast.”
“That’s true,” said Harry, with a pretended sigh; “but they might
have to be instantaneous photographs.”
Philip looked puzzled for a minute and then laughed. After they
left the tunnel, they passed through the suburbs of New York,
entered a narrow cut that turned westward, and were soon sailing
along the Hudson River—or so it seemed. There was no shore visible
beside them, except for an occasional tumble-down dock, and
beyond lay the river—a soft, gray expanse relieved against the
Palisades, and later against more distant purple hills. It was a rest
for their eyes to see only an occasional sloop breaking the long
stretch of water, and the noise of the train was lessened because
there was nothing to echo back the sounds from the river.
Mr. Douglass found his pleasure in the scenery, the widenings of
the river, the soft outlines of the hills, the long reflection of the
setting sun. But the boys cared more to see the passengers.
“Isn’t it funny,” said Philip, “how Americans take things as a matter
of course? I really believe that if the train was a sort of Jules Verne
unlimited express for the planet Mars, the people would all look
placid and read the evening papers.”
“Of course,” said Harry. “What else can they do? Would you expect
me to go forward and say: ‘Dear Mr. Engineer, but do you really
think you know what all these brass and steel things are? Don’t you
feel scared? Won’t you lie down awhile on the coal, while I run the
engine for you?’”
“Nonsense!” said Philip, laughing. “But they might show some
interest.”
“They do,” said Harry; “but that’s not what I’m thinking of. I’m
thinking I’ll be a civil engineer.”
“Why?” said Philip.
“Just think,” Harry answered, pointing from the car window, “what
a good time they must have had laying out this road! Why, it was
just a camping-out frolic, that’s all it was.”
ONE OF THE DECORATORS AT WORK.

“Didn’t you hear the waiter say dinner was ready?” said Mr.
Douglass.
“No,” said Philip; “but I knew it ought to be, if they care for the
feelings of their passengers. Where is the dining-car?”
“At the end of the train,” said Mr. Douglass. “Come, we’ll walk
through.”
So, in single file (“like cannibals on the trail of a missionary,” Harry
said), they passed from car to car. The cars were connected by
vestibules—collapsible passageways, folding like an accordion—and
it was not necessary to go outside at all. The train was an unbroken
hallway.
“It is much like a long, narrow New York flat,” said Philip. “People
who live in flats must feel perfectly at home when they travel in
these cars.”
They found the dining-car very pretty and comfortable. Along one
side were tables where two could sit, face to face. On the opposite
side of the aisle the tables accommodated four. The boys and their
tutor took one of the larger tables. The bill of fare was that of a well-
appointed hotel or restaurant,—soup, fish, entrées, joint, and
dessert,—and it was difficult to realize that they were eating while
covering many miles an hour; in fact, the only circumstance that was
a reminder of the journeying was a slight rim around the edge of the
table to keep the dishes from traveling too.
MAKING “STAFF.”

“It is strange,” said Mr. Douglass, “how people have learned to eat
dishes in a certain order, such as you see on a bill of fare. Probably
this order of eating is the result of tens of millions of experiments,
and therefore the best way.”
THE “COURT OF HONOR” AS IT LOOKED IN JUNE, 1892.

“The best for us,” said Philip; “but how about the Chinese?”
Mr. Douglass had to confess himself the objection well taken.
“I believe the Chinese were created to be the exceptions to all
rules,” he said.
The dining-car had an easy, swaying motion that was very
pleasant, and altogether the dinner was a most welcome change
from the ordinary routine of a railway journey.
As the boys walked back to their own section, Philip noticed a little
clock set into the woodwork at one end of the smoking-car. He was
surprised to see that it had two hour-hands, one red and one black.
He pointed it out to Mr. Douglass, who told him that the clock
indicated both New York and Chicago times—which differ by an hour,
one following what is called “Eastern,” the other “Central” time.
By the time they were again settled in their places it was dark
outside; and, as Philip poetically said, they seemed to be “boring a
hole through a big dark.” One of the colored porters looked curiously
at Philip, as if he had overheard this remark without understanding
its poetical bearing.
“He thinks you are a Western desperado!” said Harry, with a grin.
“Boys,” said Mr. Douglass, “the porters will soon make up the
beds, and I want you to see how ingeniously everything is
arranged.”
Here is what the porter did:
He stood straddling on two seats, turned a handle in the top of a
panel, and pulled down the upper berth. It moved on hinges, and
was supported after the manner of a book-shelf by two chains that
ran on spring pulleys.
Then he fastened two strong wire ropes from the upper to the
lower berths.
“What’s that for?” asked Harry.
“To prevent passengers from being smashed flat by the shutting
up of the berth,” Philip answered, after a moment’s puzzling over the
question.
“You can have the upper berth, Philip,” said Harry, impressively.
“It’s better ventilated than the lower, they say; but I don’t mind
that.”
Meanwhile the porter took from the upper berth two pieces of
mahogany, cut to almost fill the space between the tops of the seats
and the side roofs of the car. The edges were grooved, and slid
along upon and closely fitted the top of the seat and a molding on
the roof. These side-pieces were next fastened by a brass bolt
pushed up from the end of the seat-back.
Then the bed-clothing (kept by day in the lower seats and behind
the upper panel) was spread on the upper berth, and the mattress
of the lower berth was made up from the seat-cushions, supported
upon short slats set from seat to seat.
While the beds were being made, the boys were amused to see
some ladies laughing at the man’s method of getting the clothes and
pillows into place. A woman seems to coax the bed into shape, but a
man bullies it into submission.
“They think it’s funny to see him make a bed,” said Harry, in an
undertone; “but if they were to try to throw a stone, or bait a fish-
hook, I guess the darky would have a right to smile some too.”
To finish his work, the porter hung a thick pair of curtains on
hooks along a horizontal pole, and then affixed a long plush strip to
which were fastened large gilt figures four inches high—the number
of the section.
“It would be fun to change the numbers around,” remarked Harry,
pensively. “Then nobody would know who he was when he got up.
But perhaps it would make a boy unpopular if he was caught at it.”
Mr. Douglass admitted that it might.
As the porter made up their own section, Harry
pulled out his sketch-book and made a little
picture of him.
“It’s hard times on the railroad now,” he
remarked, as he finished the sketch. “See how
short they have to make the porters’ jackets! But
it must save starch!”
“YO’ SECTION
READY, SAH!”
The boys had wondered how the people would
get to bed, but there seemed no difficulty about it.
As for our boys, who had the upper berth, one by one they took off
their shoes, coats and vests, etc., and then climbed behind the
curtains, where they put their pajamas over their underclothes.
After they were in bed, they talked but little, for they were tired.
“This rocking makes me drowsy,” Philip said; “it’s like a cradle.”
“Yes,” Harry answered, as the car lurched a little—“a cradle rocked
by a mother with the St. Vitus’s dance!”
While going to sleep, the boys were puzzled to account for the
strange noises made by the train. At times it seemed to have run
over a china-shop, and at other times the train rumbled hoarsely, as
if it were running over the top of an enormous bass-drum.
Soon the great train was transporting two boys who were fast
asleep in Section No. 12; they woke fitfully during the night, but only
vaguely remembered where they were, until the cold light of
morning was reflected from the top of the car.
Dressing was more difficult than going to bed, but by a
combination of patience and gymnastics Harry and Philip were soon
able to take places in the line that led to the wash-room. Thence,
later, they came forth ready for breakfast (for which they had to “line
up” again), and another all-day ride.
THE OPENING OF THE FAIR, MAY 1, 1893.—THE PRESIDENT OF THE UNITED STATES SPEAKING.

At breakfast, the next table to them was occupied by a gentleman


named Phinney, and his son. Harry knew the son slightly, having
once been his schoolmate. Young Phinney was making a second visit
to the Fair, and he told Harry that on the former trip the train had
run around Niagara Falls in such a way as to give the passengers an
opportunity to view them.
GROUND PLAN OF THE WORLD’S FAIR GROUNDS.
Live-Stock Exhibit Building.
Railway Approach.
Galleries of Fine Art.
Machinery Hall, 17 1-2 Acres.
Administration Building.
Illinois State Building.
Assembly Hall and Annex to Agricultural Building.
Fountain.
Transportation Exhibit, 18 2-3 Acres.
Horticultural Hall, 6 1-2 Acres.
Villages of all Nations.
Women’s Building.
State Buildings and Buildings of Foreign Governments.
63 Acres reserved for Live-Stock Exhibit.
Hall of Mines and Mining, 8 3-4 Acres.
Forestry Building, 2 1-2 Acres.
Electrical Building, 9 3-4 Acres.
United States Government Building.
Dairy Building, 3-4 Acre.
Sawmills.
Agricultural Building, 15 Acres.
Manufactures and Liberal Arts Building, 44 Acres.
Casino and Pier.
Fisheries Building and Deep-Sea Aquaria, 3 Acres.
U. S. Naval Exhibit.
The original picture from which this illustration was engraved was painted before changes were made in the
Peristyle and Pier. The general arrangement and designs of the buildings are correct.

The train had stopped there for five minutes, and they had
climbed down near the rapids to a point where there was an
excellent view of “the great cataract”—so young Phinney called it.
He gave the boys some pictures showing the falls, and indeed there
was a picture of the falls upon the side of the breakfast bill of fare.
During the forenoon the train was passing through Canada—the
boys’ impression of that country being a succession of flat fields,
ragged woods, sheep, swine, and a few pretty, long-tailed ponies
grazing upon browning turf. Philip said that it was like “the
Adirondacks spread flat by a giantess’s rolling-pin.”
At Windsor the train, separated into sections, was run upon a
ferry-boat (upon which one small room was marked “U. S.
Customs”) and carried over to Detroit. Here Mr. Douglass made the
boys laugh by suddenly jumping back from the window. He had
been startled by a large round brush that was poked against the
window from outside to dust it.
From Detroit the train ran through Michigan—mainly through a flat
country of rich farming land. Philip, who had never been West, was
much surprised at the uninterrupted stretches of level ground. Mr.
Douglass asked him what he thought of the region. Philip adjusted
his glasses and replied slowly: “Well, it’s fine for the farmers, but it is
no place for speaking William Tell’s piece about ‘Ye crags and peaks,
I’m with you once again!’”
“You must not forget, though,” said Mr. Douglass, “that it is the
rich farming lands that really underlie America’s prosperity. When
you see the Fair, you will understand better what a rich nation we
are; but without our great wheat-lands we should, like England, be
dependent upon commerce for our very existence.”
The boys were much less talkative as the train neared Chicago.
They were somewhat tired, and were also thinking of the amount of
walking and sight-seeing that was before them.
All at once, at about half-past five, New York time (for the
travelers had not yet changed their watches to an hour earlier), Mr.
Douglass pointed out of the right-hand forward window. Both boys
looked. There, in the distance, rose above the city houses a gilded
dome, and from the opposite car-window they saw just afterward a
spider-web structure.
“I know it!” Philip sang out; “that’s the Administration Building. But
what is the other?”
“The Ferris Wheel,” answered Harry.
“Yes,” said the tutor, “we are going to leave the car not far from
the Plaisance gate.”
“Sixtieth street next!” cried the brakeman.
“Come, we get out here. It’s nearest the grounds, and I have been
told it is wise to lodge as near as possible.”
When the cars stopped, the party descended upon a platform with
“rails to the right of them, rails to the left of them,” and trains and
crowds in all directions. Mr. Douglass led the way out into the
huddled settlement of apartment-houses, hotels, and lodgings that
has sprung into existence around Jackson Park, the Fair Grounds.
Then began their search for rooms. At first it seemed
discouraging; neatness outside was not always a sign of what to
expect inside. They labored up-stairs and down again several times.
At one attractive private house they entered, expecting quiet,
homelike rooms. In the tiny parlor they found five cots set “cheek by
jowl” as close as they could be jammed. They smiled at this, but
found the rest of the rooms as fully utilized. Mr. Douglass made
some objection, and was told by the self-possessed landlady that
“some very fine gentlemen thought her fifty-cent beds were very
elegant.” At another house they were passing, a boy who couldn’t
have been over five years old rushed out like a little Indian on the
warpath, crying, “Hi! You lookin’ fer rooms?” Amused at the little
fellow’s enterprise, our travelers followed him, the boy going forward
on his sturdy little legs, and crying, “Hi, there, Mama! Here’s
roomers! I got you some roomers!”
But unfortunately the boy proved more attractive
than the rooms. After a long walk, but without going
far from the Fair Grounds, they took rooms at a very
good hotel. The price was high, perhaps, but
reasonable considering the advantages and the
demand for lodgings. They took two rooms, one with a “HI, THERE, MAMA!
double bed for the boys, the other a single room for HERE’S ROOMERS!”

the tutor.
Gladly they dropped the satchels that had made their muscles
ache, and after leaving the keys of their rooms with the hotel clerk,
they set forth for their first visit to the Fair. In order that guests
should not forget to leave their keys, each was inserted at right
angles into a nickel-plated strip of metal far too long to go
comfortably into the pocket even of an absent-minded German
professor.
“One advantage of being in a hotel,” said Mr. Douglass, as they
walked toward the entrance of the grounds, “is the fact that on
rainy, disagreeable days we can get meals there if we choose. It is
not always pleasant to have to hunt breakfast through the rain. But
usually we shall dine where we happen to be in the grounds; there
are restaurants of all sorts near the exhibits, from a lunch-counter
up.”
Along the sidewalk that led from their hotel to the entrance were
dining-rooms, street-peddlers’ counters, peddlers with trays—all
meant as inducements to leave money in the great Western
metropolis. One thing the boys found very amusing was an Italian
bootblack’s stand surrounded on three sides by a blue mosquito-
netting.
“If it had been on all sides,” said Harry, “I could have understood
it, because it might be a fly-discourager. But now I think it must be
only a way of attracting attention.”
They had arrived, luckily, on a “fête night.” Though tired and
hungry, they all agreed that it would never do not to take advantage
of so excellent a chance to secure a favorable first impression. So
they bought tickets at a little wooden booth, and, entering a turnstile
one by one, were at last in the great White City.

HERE WE ARE!
ADMINISTRATION BUILDING.
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade

Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookluna.com

You might also like