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

(eBook PDF) Learning React: Modern Patterns for Developing React Apps 2nd Edition 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 topics such as state management, React Router, testing, and server rendering, and is designed for readers with no prior knowledge of React. The book also provides access to supplemental materials and emphasizes the importance of understanding JavaScript fundamentals before diving into React.

Uploaded by

hamincuruplp
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)
13 views

(eBook PDF) Learning React: Modern Patterns for Developing React Apps 2nd Edition 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 topics such as state management, React Router, testing, and server rendering, and is designed for readers with no prior knowledge of React. The book also provides access to supplemental materials and emphasizes the importance of understanding JavaScript fundamentals before diving into React.

Uploaded by

hamincuruplp
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/ 51

(eBook PDF) Learning React: Modern Patterns for

Developing React Apps 2nd Edition install


download

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

Download more ebook from https://ebookluna.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

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/

ebookluna.com

(eBook PDF) Instructional Patterns: Strategies for


Maximizing Student Learning

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

ebookluna.com

(eBook PDF) Reflections: Patterns for Reading and Writing


2nd Edition

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

ebookluna.com

(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/

ebookluna.com
Modern Sample Preparation for Chromatography, 2nd Edition
Serban Moldoveanu - eBook PDF

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

ebookluna.com

(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/

ebookluna.com

(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/
ebookluna.com

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/

ebookluna.com

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


edition

https://ebookluna.com/product/ebook-pdf-patterns-of-world-history-
combined-volume-2nd-edition/

ebookluna.com
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
corporate@oreilly.com.

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 bookquestions@oreilly.com.

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
permissions@oreilly.com.

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 bookquestions@oreilly.com 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.
From there, community adoption started to spread. In January 2015,
Netflix announced that they were using React to power their UI
development. Later that month, React Native, a library for building
mobile applications using React, was released. Facebook also released
ReactVR, another tool that brought React to a broader range of
rendering targets. In 2015 and 2016, a huge number of popular tools
like React Router, Redux, and Mobx came on the scene to handle tasks
like routing and state management. After all, React was billed as a
library: concerned with implementing a specific set of features, not
providing a tool for every use case.

Another huge event on the timeline was the release of React Fiber in
2017. Fiber was a rewrite of React’s rendering algorithm that was sort
of magical in its execution. It was a full rewrite of React’s internals that
changed barely anything about the public API. It was a way of making
React more modern and performant without affecting its users.

More recently in 2019, we saw the release of Hooks, a new way of


adding and sharing stateful logic across components. We also saw the
release of Suspense, a way to optimize asynchronous rendering with
React.

In the future, we’ll inevitably see more change, but one of the reasons
for React’s success is the strong team that has worked on the project
over the years. The team is ambitious yet cautious, pushing forward-
thinking optimizations while constantly considering the impact any
changes to the library will send cascading through the community.

As changes are made to React and related tools, sometimes there are
breaking changes. In fact, future versions of these tools may break
some of the example code in this book. You can still follow along with
the code samples. We’ll provide exact version information in the
package.json file so that you can install these packages at the correct
version.

Beyond this book, you can stay on top of changes by following along
with the official React blog. When new versions of React are released,
the core team will write a detailed blog post and changelog about
what’s new. The blog has also been translated into an ever-expanding
list of languages, so if English isn’t your native language, you can find
localized versions of the docs on the languages page of the docs site.

Learning React: Second Edition Changes


This is the second edition of Learning React. We felt it was important
to update the book because React has evolved quite a bit over the past
few years. We intend to focus on all the current best practices that are
advocated by the React team, but we’ll also share information about
deprecated React features. There’s a lot of React code that was written
years ago using old styles that still works well and must be maintained.
In all cases, we’ll make mention of these features in a sidebar in case
you find yourself working with legacy React applications.

Working with the Files


In this section, we’ll discuss how to work with the files for this book
and how to install some useful React tools.
File Repository
The GitHub repository associated with this book provides all the code
files organized by chapter.

React Developer Tools


We’d highly recommend installing React Developer Tools to support
your work on React projects. These tools are available as a browser
extension for Chrome and Firefox and as a standalone app for use with
Safari, IE, and React Native. Once you install the dev tools, you’ll be
able to inspect the React component tree, view props and state details,
and even view which sites are currently using React in production.
These are really useful when debugging and when learning about how
React is used in other projects.

To install, head over to the GitHub repository. There, you’ll find links
to the Chrome and Firefox extensions.

Once installed, you’ll be able to see which sites are using React.
Anytime the React icon is illuminated in the browser toolbar as shown
in Figure 1-1, you’ll know that the site has React on the page.
Other documents randomly have
different content
“Maybe you shouldn’t go,” Pauline began.

“But you invited me—”

“Of course we did,” Judy broke in. “Irene is expecting all


four of us.”

“You’re so good to me!” exclaimed Clarissa. She glanced


about the small room with its first-aid equipment as if in
doubt about something. Then she said, “The nurse went
out for a minute. We don’t need to wait for her. Shall we
go?”

Judy was glad to leave. There was something


oppressive in the air. The closed-in cubicle was left for
the next emergency patient. As soon as they were
outside in the wintry air, the color came back to
Clarissa’s cheeks, and she appeared to be quite herself
again. Swirls of snow were still blowing about, now
hiding, now revealing the street ahead.

They stopped in a drugstore and had coffee and a quick


sandwich. As they were about to leave, Judy
remembered something.

“I was going to buy a bottle of golden hair wash!” she


exclaimed.

“I was, too,” Flo said. “This looks like as good a place as


any.”

“Golden hair wash,” breathed Clarissa.

“Make it three bottles,” Judy heard herself saying to the


druggist.

He regarded her curiously.


“You aren’t going to use that stuff on your red hair, are 35
you?” he inquired.

“No,” replied Judy, feeling uncomfortable under his


puzzled gaze. “It’s for a friend.”

He shook his head. “I can’t understand it. This is the


thirteenth bottle I’ve sold in the last half hour. Ordinarily
the stuff doesn’t sell too well. You have to be careful
how you use it. Follow the directions, and don’t let any
of it get into your eyes or your mouth. It will gradually
change the color of your hair. Is that what you want?”

“It’s what I want. I want to change everything about


me,” declared Clarissa.

Hugging her bottle of shampoo as if it were a magic


potion, she followed the others out of the store.

“Now I’ll be beautiful,” she kept saying. “Now I’ll be a


golden girl too.”

Flo agreed with her. “I’ll have golden hair, too. It’s
bound to make me look better. Don’t you think so,
Judy?”

The wind blew harder. Judy could scarcely make herself


heard above the weird whistling noise it was making.

“You won’t be Flo,” she shouted. “You’ll look so different


without your pretty, brown hair.”

“Who will I be?” Flo asked, glancing at Clarissa just as


the wind caught her scarf and sent it flapping. “Will
people call me a changeling?”
“Now you’re laughing at me,” Clarissa charged. “Well, 36
you can joke if you want to, but I still have a feeling I’m
not real. You must have felt there was something
different about me when you called me a phantom
friend.”

“We were talking about the empty chair,” Judy began.

“People say things sometimes without knowing why


they say them, and they turn out to be true,” Clarissa
insisted. “Mother didn’t mean it when she called me a
changeling, either, but she made me feel like one. You
know—as if the real me is hidden somewhere under this
dull, drab hair.”

“Did your mother call it dull and drab?” asked Flo. “Is
that why you’ve hypnotized the rest of us into buying
this golden hair wash?”

“Me? Hypnotized you? I thought it was the other way


around.” Clarissa seemed genuinely distressed. She
turned to look at Flo, and at that moment the thirteenth
bottle of golden hair wash fell and broke, spilling all
over the snow.

“Look what you made me do!” With a sound that was


more of a sob than a laugh, Clarissa added, “Now I can
never be a golden girl. I can never find the really, truly
me!”

37
CHAPTER VI
An Unfortunate Gift

Judy acted on impulse. She thrust her own bottle of


shampoo into Clarissa’s gloved hand.

“Take it,” she urged the surprised girl. “I don’t know


why I bought it in the first place. Irene doesn’t need it.
I’m sure she’d never use it. She’d probably think I was
out of my mind to buy it for her.”

“Take mine, too. I don’t like the looks of the stuff when
it’s spilled. And I’d be afraid to use it after what that
druggist said,” declared Flo. “I wish—”

“Wait!” cried Clarissa before Flo could finish. “See what


it does to me before you condemn it. I’ll be a glamorous
new person because of this shampoo. You just wait and
see what happens to me!”

Fear seized Judy. Suddenly she was afraid of what 38


would happen. Already she felt herself in the grip of
something she could neither explain nor understand.
Was Clarissa in its grip, too? The girl’s mood had
changed so suddenly it was alarming. Had the gift of
two bottles of shampoo worked the transformation?
Judy considered it unlikely.

“You’ve changed already. You don’t need to change the


color of your hair,” she began.
“It’s drab.”

“No, it isn’t, Clarissa. I don’t know what makes you keep


saying that. It’s just your imagination.”

The girl smiled impishly and tossed her head. A white


scarf covered her hair except for a few stray wisps that
were blowing in the wind. The ends of her scarf
fluttered like white wings behind her.

“I do have an imagination,” she admitted as if revealing


a secret she had meant to keep. “Sometimes it plays
tricks on me.”

“That’s what it was when you thought the cashier stole


your twenty dollars,” Pauline said. “You just imagined
you gave it to him.”

“Did I?” Clarissa seemed ready to admit it. “You don’t


suppose the wind could have picked the money out of
my hand, do you? It’s fierce today, isn’t it? It wouldn’t
surprise me a bit if it picked me up and carried me
away.”

Judy laughed at that.

“I can just see you being swept up into the clouds with
that white scarf trailing behind you. Like the witch who
rides through the sky on Hallowe’en.”

“She’s the thirteenth fairy in Sleeping Beauty,” replied 39


Clarissa, and she was laughing, too. “It was always my
favorite fairy tale. I can hardly wait to see Irene—”

“She isn’t playing the part of Sleeping Beauty,” Flo


interrupted. “She just introduces the show and sings.”
“I know. She told us. Sleeping Beauty is being played by
a guest star, Francine Dow. I’ve seen her on television,
and she’s lovely. I wonder if she uses golden hair wash.”

“Of course she doesn’t. Her hair is dark,” Flo said.

“No, it’s light,” Pauline contradicted.

Pauline and Flo were actually arguing about it.

“We’ll see what color it is when we reach the studio,”


Judy told them, “not that it matters. I’m tired of all this
talk about hair.”

“How much farther is it?” asked Clarissa. “It seems to


me we’ve been walking forever in this wind.”

“We’re there,” announced Pauline as they rounded the


next corner. “See the sign, GOLDEN GIRL SHOW. The
theater looks a little sad, doesn’t it? They’ve turned an
old movie house into a TV studio.”

Judy was eager to see how the cameras and other


technical equipment were arranged inside the theater
building.

“It’s warm, thank goodness!” she exclaimed as they


entered, showing their pass to a man in the lobby. He
waved a tired hand toward the left side of the theater.

“You’re early. Take any four seats,” he said with an


uninterested drawl.

“Don’t we get a chance to see the dressing rooms?”


Clarissa asked. “I’ve always wanted to see the dressing
rooms of the stars.”
“We’ll see them afterwards, I guess. I wonder where 40
the control room is. I think I’ll look around and see if I
can find it.”

“Wait, Judy!” said Pauline. “I don’t think we should go


exploring.”

But Judy didn’t see any reason why she shouldn’t leave
her seat if the others saved it for her. She shook the
snow from her coat and left it there so people would
know the seat was taken.

Most of the folding seats had been removed from the


theater to make room for the TV equipment. Those that
remained were directly under the balcony. Judy
hesitated a moment, looking around. Then she walked
down the aisle between the rows of seats until she
came to what was called the studio floor. Immediately
she recognized the different kinds of cameras and
microphones. The big mike boom, mounted on its three-
wheeled platform, stood to one side. So did the dolly, its
funny little up-in-the-air seat now empty. Judy gazed at
it for a moment. Then she turned around. There on the
balcony was the glass-enclosed control room with its
monitors and flashing lights.

“I learned more than I thought I did on that tour,” she


told the others when she returned to her seat. “The
control room is just over our heads on what used to be
the balcony of the old theater. There’s a movie on this
channel now.”

“We’ve been watching it. Probably it’s being shown for 41


the second time in this theatre,” Pauline said. “It’s so
ancient I’m sure it must have been one of the pictures
shown here before this building was made over into a
TV studio.” She pointed. “See it! They have another one
of those monitors suspended from a beam just over the
middle aisle.”

“That’s wonderful!” exclaimed Judy. “We can watch


Irene’s show on TV at the same time we’re seeing it on
the stage. Oh, there she is!”

Judy broke off with this exclamation as the people in


the surrounding seats began to clap. She joined them,
clapping so enthusiastically that her hands smarted.
Under the blazing overhead lights, Irene looked lovelier
than ever. She had appeared from somewhere behind
the star-studded curtain.

“Hi, everybody!” she said brightly when the clapping


had subsided. “Welcome to the Golden Girl show. In the
half hour before we go on the air there’s time to make
you acquainted with some of the people important to
the show.”

One by one they were introduced. Irene knew all the


technicians and called them by their first names—the
manager with his walkie-talkie, the boom man, the
camera men and their helpers. One was adjusting the
seat on the dolly.

“I’d get dizzy up there,” Judy whispered.

She had never before realized how many other people


besides actors were needed to put on a TV show. The
sound man, the lighting engineer, the director and his
assistants in the control room—each had his own part to
play.

“You people out there are part of the show, too,” Irene 42
continued. “When the hands of the studio clock point to
seven we will go on the air. In the meantime, I’d like to
present four of my best friends to the studio audience.”

“She means us. How sweet of her!” exclaimed Judy.

“Me, too?” asked Clarissa, holding back a little as the


others left their seats. “She can’t mean me. I only met
her today.”

Judy laughed. “It doesn’t take Irene long to decide who


her friends are. Come on!”

43
CHAPTER VII
A Hidden Danger

The area between the first row of seats and the Golden
Girl set was filled with a complicated maze of technical
equipment. Judy nearly tripped over a trailing cable on
the way to join Irene on the studio floor.

“Come on,” Judy urged Clarissa a second time.

Irene was waiting for them. She seemed completely at


home on the studio floor, moving through and around
the pieces of equipment as easily as she moved about in
her kitchen at home. The girls were introduced. It was
all very informal and nice. Afterwards the floor manager
suggested a quick tour behind the scenes.

“I know you want to show your friends around, Irene,”


he said with an understanding twinkle in his eyes. “You
have ten minutes.”

“Thank you, Si. I won’t take more than that. This 44


doesn’t compare with Radio City, of course,” Irene
apologized, turning to Judy, “but perhaps I can show
you something you haven’t already seen.”

“What about the dressing rooms?” Judy thought of


Clarissa’s request and explained that they hadn’t seen
them on their other tour. “It was interrupted,” she
began and then stopped as there was too much to tell
in ten minutes.

“How did that happen?” Irene asked.

“We’ll explain it later,” Judy promised. “Is there time to


see the dressing rooms?”

“They’re small and crowded tonight, but I guess we can


take a quick peek,” Irene agreed. “This way, girls! Be
careful and don’t fall over anything.”

The dusty, cluttered space behind the glittering curtain


was a disappointment to Clarissa. Judy could tell by the
look on her face. Backgrounds were folded one against
the other. Props waited to be placed inside make-believe
rooms that were nothing but painted canvas stretched
on wooden racks. Beyond, a narrow corridor separated
two rows of doors.

“Will we see Francine Dow?” Clarissa asked suddenly.

Pauline looked at Flo and said pointedly, “We had a little


argument over the color of her hair.”

“You can settle it when you see her,” Irene told them as 45
they entered the crowded dressing room. The girls who
were to be good fairies on the program were fluttering
about in their filmy dresses. Two of them were seated
before a long dressing table putting on make-up that
gave their faces a yellowish tinge. A third girl, made up
to look like an old woman, was dipping a sponge into a
bowl of green stuff and then applying it to her face.

“She must be the witch,” Pauline whispered to Judy.


“Doesn’t she scare you?”
“Her hair is green, too,” Flo observed with a giggle.
“How about washing your hair with green hair wash,
Clarissa? You said you’d do anything to get on TV.
Would you play the part of an old witch?”

“I—I don’t know,” she faltered. “I’d hate to make myself


any uglier than I am.”

Obviously the witch could hear the whispered


conversation behind her. Making her voice sound old
and cackling, she said without turning her head, “So you
think I’m ugly, my pretty? Wait until you see the curse I
put on the child! I hope I don’t scare any little kiddies
who may be watching—”

“You scare me,” Clarissa interrupted. “I can see your


face in the mirror.”

“It’s bad luck to look into a mirror over anyone’s


shoulder,” the witch warned her. “Why don’t you go
away?”

“I’m sorry.” Clarissa, her eyes still fixed on the mirrored


face of the witch, was backing out into the corridor
toward a closed door.

“Is that another dressing room, Irene?” asked Flo. “We


didn’t see your guest star, Francine Dow.”

“Would you know her?” asked Judy. “I’m afraid I


wouldn’t. She’s appeared in so many different roles. I
don’t even know what color her hair is.”

46
47
“I’m afraid I don’t either,” Irene confessed. “She wore a
black wig in the Mikado and looked quite like a
Japanese schoolgirl. She is late, but I’m sure she’ll be
here in time to play the part of the Sleeping Beauty. She
doesn’t appear until the show is half over. Maybe she
planned to be late so she would have the dressing room
to herself. We had to rehearse without her this
afternoon,” Irene continued, a worried note creeping
into her voice, “but she assured me, over the telephone,
that she knows the part.”

“The play would be ruined without Sleeping Beauty,


wouldn’t it?” Clarissa asked. “I hope I haven’t brought
bad luck.”

“Of course you haven’t. That’s just a silly superstition,” 48


Irene declared. “Actually, it makes an actress nervous to
have anyone look over her shoulder when she’s applying
make-up, so she’s apt to tell you it brings bad luck.”

“I see.”

Judy wondered if she did. “You say this isn’t a dressing


room? What is behind this other door?” she asked
curiously.

She could hear voices that made her even more curious.
“It’s forbidden!” someone was almost shouting. “This
thing is still in the experimental stage. It may be as
dangerous as an atom bomb!”

“I don’t know what all the excitement is about. This is


our film storage room,” Irene explained, tapping on the
door before she opened it. “Most of our programs are
on film or on kinescope, and they’re kept here. Mine is
one of the few live shows that originate in this studio.”

She was calm as she entered the small room that was
still charged with emotion. Rows of shelves and
pigeonholes lined the walls. Two men were glaring at
each other across a high desk.

“You look like a couple of roosters ready for a fight,”


Irene told them amiably. “Can you forget your
differences long enough to meet some friends of mine?
This is Mr. Lenz, our projectionist.”

“How do you do,” the older man said in an agitated


voice as he was introduced to the four girls.

Judy recognized the younger man as the one with the


unruly lock of brown hair.

“You were on the tour with us!” she exclaimed in 49


surprise.

“You are from our agency! Why did you tell the guide
you were from Hollywood?” Flo demanded.

“Usually,” said the brown-haired young man with an


easy smile, “I tell people what they want to hear. You
want me to be Blake van Pelt, a native New Yorker. Yes,
my dear Miss Garner, that is my name. I already know
yours because, you see, I do work on Madison Avenue
just as you do—and for the same agency, so I think we
understand each other. The guide, another charming
young lady, wanted me to be from out of town so I gave
her a line.”

“Did you say line or lie?” Flo was angry now and
justifiably so, Judy thought. Without in the least
understanding what was going on, she felt herself on
the side of truth. Something Clarissa had said back in
the restaurant flashed across her mind. “Doesn’t
anybody in New York care about the truth?” Apparently
there were a number of people who did, among them
the white-haired projectionist, Mr. Lenz.

“The word is lie,” he said icily. “So you tell people what
they want to hear, do you, Mr. van Pelt? I think the
purpose of your agency is to make them dissatisfied
with what they have so they’ll buy what you have to
sell.”

The young man flashed another smile.

“You’ve put it very well. Advertising is a selling job. 50


We’re not in business to entertain people or to make
them contented as they sit in their living rooms
watching TV. Contented people are like cows. It’s our
job to make them discontented. That’s no crime, is it,
Mr. Lenz?”

“No, but this is! None of the other networks allow it. I
have my orders from the director of this program,” the
projectionist declared. “Now, suppose you take your film
out of here.”
Young Blake van Pelt picked up a round gray can about
an inch thick and a foot across, and sauntered out of
the room. Did it contain a roll of film or something more
sinister? Judy found herself wondering what Mr. Lenz
meant when he had shouted, “It may be as dangerous
as an atom bomb!” After he had calmed down a little
the projectionist opened a can similar to the one the
younger man had taken away with him and said to
Irene, “This is the ad we’ll run on your show, Mrs.
Meredith. It’s for a tooth paste approved by dentists,
and features a cute little girl cleaning her teeth.”

“It may inspire little Judy,” Irene began and then


stopped. “What was the other ad?” she asked. “Why
were you so angry about it, Mr. Lenz?”

“An old man’s temper,” he replied. “Don’t mind me, and


good luck with your show tonight.”

51
CHAPTER VIII
The Witch’s Curse

“I’ll need more than luck if anything is wrong in the film


department,” Irene said later when they were back on
the studio floor.

She was worried about something. Judy could see that.


She took the seat Pauline was saving for her. Flo was
already seated next to Pauline with Clarissa occupying
the chair next to the aisle. An usher was seating people
in every available place.

“No empty seats! No empty seats!” he kept on repeating


as the crowd surged in.

Two pedestal cameras were stationed directly in front of


the curtain where Irene stood waiting. At one side,
mounted on a large three-wheeled platform, rode the
man who operated the mike boom. The man on the
dolly was sitting in his funny little seat with the operator
ready to raise or lower him.

The hands of the big studio clock over the exit door 52
moved slowly toward the hour of seven. The camera
men and the boom man, all wearing headphones, stood
ready before their equipment. The floor manager also
waited for the directions he would receive through his
headpiece.
“All set?” asked the announcer.

“All set,” Irene replied, smiling.

Did Judy imagine it, or was her smile a little forced?


“Nothing must go wrong,” Judy caught herself almost
praying. “Please, don’t let anything go wrong.”

“One minute ... stand by!” sounded over the


loudspeaker.

Were the other girls as tense as she was? Judy found it


hard to read the expressions on their faces. The lights
over the Golden Girl set made everything else look dim.

The television set suspended over the middle aisle was


showing the end commercial from the previous show. As
soon as it was over red lights flashed above the exit
doors, and Judy knew Golden Girl was on the air. The
announcer stepped to one side, out of camera range,
and clapped his hands as a signal for the audience to
clap.

“Isn’t she lovely?” whispered someone in the audience


as the bright spotlight shone down on Irene. Quick tears
came to Judy’s eyes as Irene began to sing:

“My own golden girl, there is one, only one,


Who has eyes like the stars and hair like the sun.”

It was her theme song. Judy’s thoughts took her back to 53


the first time she had heard it on a roof garden while
she danced with Dale Meredith.

“Irene is a golden girl tonight,” he had said, and from


then on her happiness had become his chief concern.
Judy thought of him now, at home in their new Long
Island house, probably holding a sleepy baby on his
knee as he listened.

“That’s Mommy,” he would be saying to little Judy. Or


perhaps there was no need to say it. By now Judy’s little
namesake must be well acquainted with the mysteries
of TV.

“Better acquainted than I am,” Judy thought ruefully.

She couldn’t overcome the fear that something would


go wrong with the show. Little Judy wouldn’t see the
microphone dangling over her mother’s head. She
wouldn’t see the cameras being moved in like menacing
monsters. She wouldn’t know, as Judy did, that
somewhere back in the film room there had been
something “as dangerous as an atom bomb.”

“If Peter were here I could ask him about it,” Judy
thought.

“The advertising is over, and the show is about to


begin,” Pauline whispered.

Judy glimpsed the little girl cleaning her teeth on the TV


set. Since the advertising was all on film, it did not seem
to interrupt the play that was now beginning.

“Look!” she heard Clarissa whisper. “It’s the palace 54


scene with the king and queen. I wonder if that’s a real
baby in the crib.”

On the television screen the king and queen seemed to


be crooning over a real baby, but Judy suspected the
crib was empty. The throne room was only a painted
scene on a wooden frame with a few props in the
foreground to make it appear real. The spotlight rested
on the royal family for a moment and then moved over
to Irene. Dressed as one of the fairies, she sang to
summon the others:

“Fairies! Fairies! Now appear


Bringing gifts for baby dear.
One will give a pretty face,
Two a body full of grace,
Three the love light in her eyes.
Four will make her kind and wise.”

In danced the fairies bringing their gifts and waving


their wands over the crib. On the screen flecks of
stardust could be seen swirling about. Remembering the
tour, Judy knew how this effect was achieved.

More gifts were bestowed on the little princess as the


next seven fairies danced in. Irene’s song was as
beautiful and tender as a lullaby. A film strip of a real
baby made it seem as if the audience had been given a
glimpse of the little princess in her crib.

It was almost too real when the witch whirled in. A gasp
went up from the audience as she interrupted the fairy
song with a hoarse shriek:

“I was not invited. Why?


For punishment I’ll make her die!”

“No, oh, no!” Judy almost forgot it was a play and found 55
herself crying out with the fairies. All had given their
gifts except Irene, who was playing the part of the
twelfth fairy.

The queen, rising from her throne, began to explain


that there were only twelve golden plates for feasting.
“That is why you weren’t invited, dear, good fairy,” she
said to the witch. “Please take away your curse.”

“For shame!” cried the witch. “I’ll make it worse!


She shall live to age fifteen,
But she shall never be a queen.
While spinning she shall prick her hand.
There’ll be no cure in all the land.”

“Have pity! Have pity!” cried the poor queen, wringing


her hands and sobbing so realistically that Judy almost
cried with her.

“I will have every spinning wheel destroyed,” the king


declared. “This cruel pronouncement must not come to
pass.”

“Can’t you help us, dear fairies?” sobbed the queen.

They drooped like wilted flowers. “I’m afraid not,” one


after another of them replied. “She is not one of us. She
is a witch. Her powers are greater than ours, but we will
try.”

At that they began dancing around the witch, trying to


touch her with their wands. The music played wildly as
the witch whirled and danced, always eluding them and
finally dancing off the set.

“She’s gone!” exclaimed the king. “She’s left her curse 56


on all of us.”

“You good fairies, is there nothing you can do?” The


queen turned to the dancers with a pleading gesture.
Eleven of them shook their heads. Irene, the twelfth
fairy, danced into the spotlight and began to sing:
“A twelfth gift I have yet to give.
The princess shall not die, but live.
A fairy mist will change the spell
From death to sleep. She shall sleep well
A hundred years. Yes, all shall sleep.
Change, curse, from death to slumber deep!”

With a wave of her wand, Irene stepped out of camera


range and stood smiling and bowing to the studio
audience as the curtain descended. Judy forgot to look
at the advertising. She was seeing only Irene.

“She’s the star of this show. Francine Dow can’t be any


more wonderful than she was,” Judy whispered.

“I hope she’s here.”

Was Pauline worried, too? Clarissa was heard to


whisper, “Oh dear, I left my two bottles of shampoo
back there in the witch’s dressing room.”

“You can get them after the show,” Flo whispered back.
She turned to Pauline and said something about the
commercial. Several people left their seats during the
intermission, but Judy stayed where she was. She didn’t
want to miss anything.

As soon as the commercial was over, the cameras were 57


again on Irene. She stood in front of the curtain.

“The king has issued a decree commanding that every


spindle in the kingdom be burnt, but it is no use,” she
said sadly. “Fifteen years have passed. The witch’s curse
is almost forgotten, but look what’s hidden away in a
dusty old room at the top of the castle!”
The curtain opened on the set she had described.
There, before an old spinning wheel, sat the witch
spinning flax. For a time nothing was heard except the
whir of the spinning wheel. Then a door opened, and a
lovely young girl tiptoed in. Judy breathed a sigh of
relief.

“It’s Francine Dow! Her hair is golden just as I knew it


was,” Pauline whispered.

“It could be a wig,” Flo whispered back.

The princess stood behind the old witch, not saying a


word until she turned her head. Then, appearing
frightened, she said, “Good day, my good lady, what are
you doing here?”

“I am spinning,” said the witch, nodding her head.

“What thing is that which twists round so merrily?”

“It is a spindle. Want to try it, my pretty?”

It was the same evil voice Judy had heard back in the
dressing room.

“I—I’m afraid.”

The princess did sound afraid as she took the spindle. 58


Her long golden hair fell almost to her waist. Were those
real tears in her eyes when she pricked her finger? She
fell, almost immediately, in an undramatic pose with her
face turned away from the audience. The witch,
chuckling softly to herself, began to chant:

“My curse is done. The sleep of death


Shall take away the princess’ breath!”
Judy drew a breath of her own that was almost a gasp.
She knew the old fairy story by heart, and yet there was
a moment when the play seemed so real that she
wasn’t at all sure the curse wouldn’t come true.

59
CHAPTER IX
Into the Mist

“Isn’t it spooky?” Pauline whispered, breaking the spell


that was upon Judy. The theater was so dark she
couldn’t see her friend, but she could hear her voice.
She was about to answer when the sound of a wailing
siren reached her ears.

“What’s that?” she questioned fearfully.

Pauline touched her arm. “Judy! You’re all goose-flesh,”


she whispered. “It’s only an ambulance. Probably there
was an accident outside. But don’t worry about it. We’re
safe enough in here.”

“I hope we are.” Judy had thought, for just a fleeting


moment, that something might have happened back in
the film room. Maybe an explosion or a fire. But
common sense told her Pauline was right. Her attention
was drawn back to the set where the fairies were now
singing:

“The witch! The witch! Her curse came true. 60


Pray tell us, what can fairies do?”

“Nothing, my pretties!” chuckled the witch. She nodded


her head so that the green hair fell in straggly wisps
across her ugly face and repeated, “Nothing, my
pretties. You can do nothing at all.”
“Not so! Not so!” cried all the fairies, rushing at her in a
wild dance, their feet flying faster and faster as the
music increased in tempo.

Judy and her friends sat in rapt attention as did the


entire audience. The siren outside could still be heard
wailing above the music, but nobody paid much
attention to it. Irene, leading her train of fairies, drove
the witch into the wings and returned to where the
princess had fallen.

“She only sleeps. She is not dead.


We’ll take her to her royal bed,”

the fairies sang softly. Making cradles of their arms, they


lifted the sleeping princess and carried her to another
set where she was placed in a canopied bed to sleep for
a hundred years.

“Isn’t she beautiful?” Judy whispered. “She looks—”

“Watch!” Pauline interrupted as the cameras turned 61


quickly on another set showing the kitchen of the castle.
Here the cook fell asleep just as she was raising her
hand to box the ears of the kitchen boy. In still another
room the king and queen fell asleep on their thrones.
Finally the audience was given a glimpse of the castle
itself. It was only a background painting pulled down to
hide the various sets, but it looked real enough on the
television screen. Irene, standing in front of it, waved
her wand and began to chant:

“Arise, oh misty vapors, rise


To hide from all beneath the skies
The place where Sleeping Beauty lies.”
“Look!” whispered Judy. “Now I know why everything is
so misty. Steam is being blown from a big black kettle
over there to the right.”

The mist was now very dense. A fan was blowing it


across the set. When it cleared away the castle had
changed. A thick growth of weeds and brush made it
seem as if a hundred years had passed during the brief
pause for the commercial.

All this time Irene had been standing to the left of the
set. She introduced the prince, now seen in a puzzled
pose before the forsaken castle.

“What’s this?” he cried. “A lovely castle now appears.


The mist has hidden it for years.”

Parting the thorny bushes, he made his way toward it.


Suddenly, to Judy’s surprise, the whole background
scene went up like a window shade, revealing the
rooms inside the castle.

“There’s Sleeping Beauty again! Isn’t she lovely?” a


voice behind Judy whispered.

“And so young looking!” another whispered. “Isn’t it


wonderful that Francine Dow can still play the part of a
fifteen-year-old girl?”

The face of the actress was turned a little away from 62


the viewers. A veil covered it. She lay as still as death
until the prince lifted the veil and kissed her. Then
quickly, almost too quickly, it seemed to Judy, the play
ended and Irene was before the cameras singing her
closing song. She sang it all the way through. When it
was finished, she blew a kiss to the children in the
audience, adding, “And here’s one for you, Judykins.”

You might also like