0% found this document useful (0 votes)
15 views44 pages

React Programming The Big Nerd Ranch Guide 1st Edition Loren Klingman PDF Download

The document is a comprehensive guide to React programming, covering essential topics such as components, state management, user events, and server interactions. It includes practical challenges and resources for further learning, along with a detailed table of contents outlining various chapters and concepts. Additionally, it provides links to related programming books and resources for learners interested in expanding their skills.

Uploaded by

hanifymatafa65
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
0% found this document useful (0 votes)
15 views44 pages

React Programming The Big Nerd Ranch Guide 1st Edition Loren Klingman PDF Download

The document is a comprehensive guide to React programming, covering essential topics such as components, state management, user events, and server interactions. It includes practical challenges and resources for further learning, along with a detailed table of contents outlining various chapters and concepts. Additionally, it provides links to related programming books and resources for learners interested in expanding their skills.

Uploaded by

hanifymatafa65
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/ 44

React Programming The Big Nerd Ranch Guide 1st

Edition Loren Klingman pdf download

https://ebookmeta.com/product/react-programming-the-big-nerd-
ranch-guide-1st-edition-loren-klingman/

Download more ebook from https://ebookmeta.com


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

Swift Programming The Big Nerd Ranch Guide Mikey Ward

https://ebookmeta.com/product/swift-programming-the-big-nerd-
ranch-guide-mikey-ward/

Android Programming The Big Nerd Ranch Guide 5th


Edition Kristin Marsicano

https://ebookmeta.com/product/android-programming-the-big-nerd-
ranch-guide-5th-edition-kristin-marsicano/

Android Programming The Big Nerd Ranch Guide 4th


Edition Kristin Marsicano & Chris Stewart & Bill
Phillips.

https://ebookmeta.com/product/android-programming-the-big-nerd-
ranch-guide-4th-edition-kristin-marsicano-chris-stewart-bill-
phillips-2/

Genki Textbook Volume 2 3rd edition Multilingual


Edition English and Japanese Edition Eri

https://ebookmeta.com/product/genki-textbook-volume-2-3rd-
edition-multilingual-edition-english-and-japanese-edition-eri/
The Latte Factor Why You Don t Have to Be Rich to Live
Rich Bach David Mann John David

https://ebookmeta.com/product/the-latte-factor-why-you-don-t-
have-to-be-rich-to-live-rich-bach-david-mann-john-david/

Speculative Coolness : Architecture, Media, the Real,


and the Virtual 1st Edition Bryan Cantley

https://ebookmeta.com/product/speculative-coolness-architecture-
media-the-real-and-the-virtual-1st-edition-bryan-cantley/

Introducing Software Verification with Dafny Language:


Proving Program Correctness 1st Edition Boro
Sitnikovski

https://ebookmeta.com/product/introducing-software-verification-
with-dafny-language-proving-program-correctness-1st-edition-boro-
sitnikovski/

The Running Man 15th Edition Stephen King

https://ebookmeta.com/product/the-running-man-15th-edition-
stephen-king/

Planning Climate Smart and Wise Cities A


Multidisciplinary Approach 1st Edition Kwi-Gon Kim

https://ebookmeta.com/product/planning-climate-smart-and-wise-
cities-a-multidisciplinary-approach-1st-edition-kwi-gon-kim/
The Commemoration of Women in the United States
Remembering Women in Public Space 1st Edition Teresa
Bergman

https://ebookmeta.com/product/the-commemoration-of-women-in-the-
united-states-remembering-women-in-public-space-1st-edition-
teresa-bergman/
React Programming
Table of Contents
Introduction
Learning Web Development
Learning React
Prerequisites
How This Book Is Organized
How to Use This Book
Typographical conventions
Using an eBook
For the More Curious
Challenges
The Necessary Tools
Installing Google Chrome
Installing Visual Studio Code
Crash Course in the Command Line
Finding the current directory
Changing directories
Creating a directory
Listing files
Getting administrator privileges
Quitting a program
Installing Node.js
Resources
Finding Documentation and Help
1. Create React App
Create React App
Running the Development Server
Navigating Your App
Project metadata and dependencies
public directory
src directory
Customizing Your App
Title
Favicon
Adding Elements
Styles
The Chrome Developer Tools
Conclusion
Are You More Curious?
For the More Curious: npx
For the More Curious: %PUBLIC_URL%
Challenges
Bronze Challenge: Subtitle
Silver Challenge: Canarygram
2. Components
App Organization
Header Component
JSX
Post Component
React Developer Tools
Why name components?
Props
Reusing a Component
Object destructuring
Rendering Lists
Keys
Conclusion
For the More Curious: Testing Prop Changes in the
DevTools
Bronze Challenge: Footer
Silver Challenge: Canarygram Footer
3. User Events
Adding SelectedItem
User Events
Passing Parameters
Conclusion
For the More Curious: Alternate file-naming conventions
For the More Curious: Detaching Event Handlers
Bronze Challenge: Hello, Goodbye
Silver Challenge: Canary Alert
4. State
What Is State?
useState
Updating State
Conclusion
For the More Curious: Components – Functions vs Classes
Gold Challenge: Canary Shuffle
5. Linting
Creating a Project
Updating the Title and Favicon
Linting Overview
Linting Rules
Installing and configuring Airbnb’s ESLint
Running ESLint
Auto-fixing errors
Overriding ESLint rules
Installing the ESLint Extension in Visual Studio Code
Conclusion
For the More Curious: Shortcuts to Running ESLint in
Visual Studio Code
For the More Curious: Linting Before Committing
6. Prop Types
Adding Resources
Header Component
Whitespace issues
Adding the component to App.js
Styling the header
Thumbnail Component
Prop Types
Installing the prop-types library
Thumbnail Prop Types
Rendering Items
Home Component
Reusing Prop Types
Prop Mismatch
Conclusion
For the More Curious: Why Pass Items as a Prop?
For the More Curious: Inlining Images
Bronze Challenge: Add a Prop
7. Styles
Style Scoping
Responsive Design
Media Queries
Hover Effect
Animating the hover effect
Conclusion
For the More Curious: Grid Layout
For the More Curious: Styled Components
For the More Curious: Compiled CSS
Silver Challenge: Custom Effect
8. Interacting with a Server
Setting Up the Server
Creating a proxy
Adding an HTTP request library
useEffect
Confirming the Network Request
Promises
How promises work
Conclusion
For the More Curious: Server Endpoints
For the More Curious: How to Set Up a Proxy in Production
For the More Curious: Cross-Origin Resource Sharing
(CORS)
For the More Curious: useEffect vs Lifecycle Methods
Silver Challenge: Promise Practice
9. Router
Creating Routes
Using Link
Creating the Details Page and Route
Nesting a route
Index route
useParams
Navigating Home from the Header
Navigating from Thumbnails to Details
Conclusion
Silver Challenge: More Routes
10. Conditional Rendering
Getting Additional Item Info
Undefined Items
if Statements
Inline Logical Operators
Fragments
More Logical Operators
The && operator
The || operator
The ?? operator
Boolean Type Conversion
Conclusion
For the More Curious: Truthy and Falsy Values
Silver Challenge: Promote Sale Items
11. useReducer
useReducer vs useState
Implementing useReducer
The Reducer Function
Updating the Quantity
Displaying Information in the Header
Adding Items to the Cart
Action Creators
Conclusion
12. Editing the Cart
Creating the Cart Page
Linking to the cart page
Viewing the Cart’s Contents
Displaying the Cart Contents
Displaying the item title and price
Removing Items from the Cart
Passing dispatch as a prop
Setting up the remove button
Emptying the Cart
Displaying the Subtotal
Conclusion
Bronze Challenge: Increasing the Quantity
Silver Challenge: Decreasing the Quantity
13. Forms
Building the Form
onSubmit
Value from Inputs
Controlled Components
onChange
Calculating the Tax
Calculating the Total
Displaying the total conditionally
Formatting Input
Form Validation
Conclusion
Silver Challenge: Coupon Code
Gold Challenge: Maintaining the Cursor Position in the
Phone Number
Gold Challenge: Setting the Quantity
14. Local Storage and useRef
Local Storage
useRef vs useState
Using setTimeout with useRef
Accessing DOM Elements
Accessibility Considerations
Conclusion
Silver Challenge: Returning Focus to the Name Input
15. Submitting Orders
Submitting a Form
async/await
Comparing async/await and then/catch
Preventing Inadvertent Submissions
Conclusion
Bronze Challenge: Reset the Cart State
Silver Challenge: How Many Orders Are in the Queue?
16. Component Composition
Alert
Conditionally Showing an Alert
Component Composition with Props
Reusing Alert
Emptying the Cart
Conclusion
Gold Challenge: Closeable Alert
17. Context
Getting the Logged-In User
Login Button
Avoiding Prop Drilling
Passing currentUser with Context
useMemo
useContext
Login Component
useNavigate
Logout Button
Login Error
Conclusion
For the More Curious: Login Cookie
Silver Challenge: Items Context
18. Fulfilling Orders
Creating the Orders Component
Orders Link
Fetching and Displaying Orders
Fulfilling Orders
Restricting Access with a Custom Hook
Custom hooks
Adding to the dependency array
Cleaning Up useEffect
Getting New Orders
Proxying a websocket
Using the websocket
Closing the websocket
Conclusion
Bronze Challenge: Smarter Redirect
Bronze Challenge: Import a Custom Hook
Silver Challenge: Loader
Silver Challenge: Error Display
19. Introduction to App Performance Optimization
React Profiler
Memo
Context Changes
useCallback
Expensive Calculations
Comparing useCallback, useMemo, and memo
Cleaning Up
Conclusion
Silver Challenge: Memoized UserDetails
20. Testing Overview
Deciding What Tests to Use
Why are you testing?
What do you want to know?
What does the future look like?
Types of Testing
Static Testing
Unit and Integration Testing
Unit testing for functions
Integration testing for components
Testing the full app
Snapshot testing
End-to-End Testing
End-to-end testing with a live back end
End-to-end testing with a mocked back end
Which to use?
Visual or Screenshot Testing
Conclusion
21. Testing with Jest and the React Testing Library
Housekeeping
Unit Testing
Integration Testing
Testing Thumbnail
Testing Home
Mocking the Server
Testing the Logged-In User’s Username
Testing Navigation
Testing the Add to Cart button
Testing checkout
Verifying order submission
Checkout Error
Mocking console.error
Conclusion
For the More Curious: File Structure for Test Files
For the More Curious: React Testing Library Queries
Bronze Challenge: Testing Removing an Item from the Cart
Silver Challenge: Additional cartReducer Tests
Silver Challenge: Testing Phone Number Formatting
Silver Challenge: Testing Tax Details
Gold Challenge: Additional Login Tests
22. End-to-End Testing
Installing and Configuring Cypress
Configuring scripts
Setting up ESLint for Cypress
Importing commands
Setting the base URL
Testing the Login Flow
Testing the Checkout Flow
Interacting with the server
Testing errors in the checkout flow
Testing the Flow to View and Delete Orders
Clearing the orders
Factoring Out Custom Commands
Invisible Elements
Avoiding Flaky Tests
Conclusion
For the More Curious: Cypress Media Files
For the More Curious: Cypress Network Requests
Silver Challenge: Testing Phone Number Formatting
Silver Challenge: Testing Cart Details
Silver Challenge: Testing Removing an Item from the Cart
Gold Challenge: Additional Tests
23. Building Your Application
Manifest
Building the Application
Deploying Your Application
Conclusion
24. Data Loading
Production Build
Analysis
Large Images
Analyzing JavaScript Files
Lazy Loading
Naming the bundles
Other Considerations
Conclusion
Gold Challenge: Lazy Loading
25. Component Speed
Inspecting Performance
Transitions
Storing Rendered Content
Storing a Rendered Component
Conclusion
Gold Challenge: Caching the Filtered Data
26. Afterword
The Final Challenge
Shameless Plugs
Thank You
Index

List of Figures

1. Downloading Google Chrome


2. Downloading Visual Studio Code
3. Finding the Terminal app on a Mac
4. Mac command line
5. Finding the PowerShell on Windows
6. Windows command line
7. Showing the current path using pwd on a Mac
8. Showing the current path using pwd on Windows
9. Changing and checking directories on a Mac
10. Changing and checking directories on Windows
11. Using ls to list files in a directory on a Mac
12. Using ls to list files in a directory on Windows
13. sudo warning
14. Opening PowerShell as an administrator
15. Downloading Node.js
1.1. Preview of the completed Ottergram app
1.2. Creating a new React app
1.3. Viewing the React app in the browser
1.4. Opening a folder in Visual Studio Code
1.5. Opening Ottergram in Visual Studio Code
1.6. Prompt to trust the authors
1.7. Initial files and folders generated by Create React App
1.8. public directory explorer
1.9. src directory explorer
1.10. Viewing the header in the browser
1.11. Viewing the new title in the browser
1.12. New favicon in the browser tab
1.13. A list of otters
1.14. Ottergram, with style
1.15. Opening the Chrome Developer Tools
1.16. Viewing the Chrome DevTools
1.17. Inspect Element button
1.18. Inspecting the header
1.19. <h1> information in the Elements tab
2.1. Ottergram with stand-out names
2.2. Ottergram wireframe
2.3. Adding a new folder
2.4. Naming the new folder
2.5. Adding a new file
2.6. Naming the new file
2.7. Wireframe highlighting repeated elements
2.8. Creating Post.js
2.9. Chrome Web Store
2.10. Opening the React DevTools
2.11. Viewing components in the React DevTools
2.12. Post component in the DevTools
2.13. Anonymous component name
2.14. Viewing Post props in the DevTools
2.15. Multiple components
2.16. Bold otter names
2.17. Key warning in the browser
2.18. Keys in the Components tab
2.19. No keys in the Elements tab
2.20. Editing the name prop in the DevTools
3.1. Barry takes center stage
3.2. New SelectedItem.js file
3.3. Viewing the selected otter in the browser
3.4. Viewing console logs in the browser
3.5. All otter names in the console
3.6. Otter names in the console
4.1. Completed Ottergram
4.2. Viewing state in the React DevTools
5.1. Completed Code Café
5.2. Create React App
5.3. Opening the Code Café folder
5.4. Toggling the explorer
5.5. Title on the browser tab
5.6. Favicon on the browser tab
5.7. Adding the ESLint extension to Visual Studio Code
5.8. ESLint missing semicolon warning
5.9. One problem
5.10. Problems pane
5.11. ESLint action menu
5.12. ESLint keyboard shortcuts
5.13. Editing settings.json
6.1. Code Café at the end of this chapter
6.2. Adding a folder
6.3. Visual Studio Code’s status bar
6.4. Updating the current file’s end-of-line sequence
6.5. Updating the end-of-line settings
6.6. Updating tab size settings
6.7. Viewing the header in the browser
6.8. Viewing the styled header in the browser
6.9. ESLint prop types error
6.10. Items displayed in the browser
6.11. ESLint compilation errors
6.12. Completed components
7.1. Hover effect
7.2. Brown thumbnail titles
7.3. Black thumbnail titles
7.4. Desktop design
7.5. Mobile design
7.6. Toggling the device toolbar
7.7. Previewing the site on iPhone 12 Pro
7.8. Thumbnails in the browser
7.9. Header in the browser
7.10. Completed hover effect
8.1. The server is listening
8.2. Viewing the server in the browser
8.3. Items in the browser
8.4. DevTools Network tab
8.5. Filtering network requests
8.6. items requests
8.7. Preview pane
8.8. Viewing items from the server in the browser
9.1. Item details page
9.2. Invalid route
9.3. New “Page Not Found”
9.4. /details route
9.5. Coffee details
9.6. “Detail Item” text rendering in the browser
9.7. Displaying the “No Item Selected” index route
9.8. Viewing coffee’s ID in the browser
9.9. Search results
10.1. Completed DetailItem
10.2. Coffee details
10.3. Console error
10.4. “Loading…” rendered
10.5. Parts of a ternary
10.6. “Loading…” rendered with the header
10.7. Undefined item console error
10.8. Unknown Item
10.9. Inspecting the fragment
10.10. items in the Network tab
10.11. Conditionally rendering the cookie description
10.12. Conditionally rendering the coffee description
10.13. Cookie sale price
10.14. Coffee is not on sale
10.15. Free coffee!
10.16. Console tab arrow
10.17. Testing values in the console
11.1. Code Café’s header at the end of the chapter
11.2. Cart icon
11.3. Reducer flow
11.4. Working cart badge
12.1. Completed cart
12.2. Cart page
12.3. App component in the DevTools
12.4. Parsing the hook names
12.5. Displaying the hook names
12.6. Displaying the hook state
12.7. Displaying the cart contents
12.8. Item titles in the cart
12.9. Displaying the cart contents with prices
12.10. Removing items from the cart
12.11. Displaying an empty table
12.12. Empty cart
12.13. Drinks for two
13.1. Completed checkout form
13.2. New checkout form
13.3. Inspecting the form elements
13.4. Cart with checkout form
13.5. After submitting
13.6. SyntheticBaseEvent in the console log
13.7. Event target
13.8. Input values in the console log
13.9. Input error
Exploring the Variety of Random
Documents with Different Content
Now he stabbed at her again:
"You have let me love the promised wife of Lord Wenderby for six
months."
"No," she sharply corrected him; "I answered him yesterday."
"But you had this in your mind?" Peter insisted.
Lady Mary was too deeply grieved for dignity or anger.
"I am on my defence, it seems," she said, suddenly weary of their
fruitless talk.
"You have made me your judge," he bitterly retorted. "Why else do
you tell me these things?"
"I wanted you to understand."
"I shall never understand."
Lady Mary looked at Peter, and saw the face of an enemy.
"We will put an end to this," she said. "It is useless."
She moved to dismiss him. Peter saw her passing to another.
He took her by the arm, harshly.
"You cannot so easily be rid of me."
"I do not know you, Peter," she protested, drawing away from him.
He released her as to the troubled surface of his mind there came an
impulse of his old devotion.
"How can you do this thing?" he asked in a burst of grief. "You were
the angel of my life."
Her pride sank at this.
"Peter, be just to me," she said. "This is a sacrifice."
He caught at the word, and returned to his old refrain.
"Sacrifice! You do not love Lord Wenderby."
"I shall be his wife. I am content to work with him."
"Lord Wenderby is old," said Peter brutally. "He has bribed you to
give him all your beautiful years."
She shrank from the climbing rhetoric of his passion.
"It is infamous," he almost shouted.
Lady Mary flung back the challenge.
"It is my appointed work. I shall work with Lord Wenderby for all I
hold dear. I am going to live as Eustace Haversham died. Cannot you
realise that this is required of me? I cannot choose only for myself.
You must understand me, Peter. I can only endure this if you will
believe that I am doing what is right."
Peter was obstinate.
"I do not believe it," he said. "It is a terrible mistake."
"Once you believed," she reminded him.
"I believed in you."
She faced him, queenly now, as when Peter had worshipped her. His
soul fell suddenly at her feet.
"I still believe in you," he cried out. "I believe that you are too dear
to be flung away."
"I cannot value myself as you do."
"You are giving yourself up," he said contemptuously, "so that your
people for a few more years may live as we are living now."
"So that we may for a few more years be allowed to work as we
must," she corrected him.
Peter was silent. He had seen her justification, but his passion
prompted him to put it away. Lady Mary now touched him to the
quick.
"You begin to see that I am right," she said, searching for his
acquiescence.
"I see nothing," he insisted. "I only see that I am losing you."
"You make this very difficult," she said, trembling before the passion
of his voice.
"Difficult!" He caught her by the arm. "Why should you care what I
say or believe?"
She looked at his fingers imprinted in her flesh. She was weary and
faint. She knew that love without reserve was confessed in her eyes.
"You know that I care, Peter. Please let me go."
Peter leaned towards her. He wanted to see her face. She felt that in
a moment she must yield the message shut under her lids. She
desperately shook free of him and stood away. But Peter read the
deep flush of her neck and the motion she made to suppress the
labour of her breath. She superbly filled his eyes against a
background that had grown dim. He caught at her.
"My darling," he suddenly cried out, "I cannot let you go."
She felt the blood rushing to cover her.
"On your honour, Peter."
For a moment he was checked. "Tell me again to leave you," he said.
She faced him, and her eyes were fast held. He read the whole of
her secret. In a flash his arms were about her.
"You cannot tell me to go."
She rested helplessly. Peter held her with a fierce pride. He would
not surrender her. She closed her eyes upon a whispered entreaty as
he touched her lips. He felt the stir of her heart, and the jealousy of
possession utterly claimed him. Something wild and cruel lit in him.
He kissed her upon the face and neck. She felt them as the kisses of
mere hunger, and she suddenly rebelled.
"Peter, you dishonour me." Her voice smote into him a revelation.
Already the passion had gone out of him. It had died in the act of
touching her. He knew what he had done; he was utterly ashamed.
His arms fell away from her. He stood with bent head waiting for her
decree.
"I will write to you, Peter."
He accepted his dismissal, turning without a word. Lady Mary heard
that the door had closed. She stood silently for a moment. Then, all
that evening, she lay back in her chair stone still. Her eyes were
tight shut; but at long intervals a tear was forced from under her
lids, and fell insensibly.
XXXVI
Peter blundered away into the streets, an outcast. He walked
furiously about, getting in the way of people who looked for
pleasure.
He lived again the late encounter. Remotely he saw himself quietly at
the feet of Lady Mary, before he had lost his happy peace. Then the
storm was loose, and he saw her merely as one to be desired and
held. Finally, his imagination inexorably came full circle in the cold
shame with which he had left her. He repeated continually the
moment when his kisses had gone out, and he knew them for the
vulgar gust of his jealousy. Their passion had not been true. Lady
Mary had cried in bitter verity. They dishonoured her.
Was all the story equally a falsehood? Peter dipped for assurance
back into the quiet past. He floated again with Lady Mary under a
dying sky, and saw her unattainably fair, with a hand that quietly
rested under his. Surely this had been wonderful. Not even the stain
of his brutal hunger for her dedicated beauty could destroy it.
Why, then, did he so certainly know that his passion to-night was
evil? His conscience, bringing him to a reckoning, told him that he
did not love her. There was a rift, not to be closed, between his
adoration of Lady Mary and the passion with which he had thought
to claim her. He put Wenderby aside, and asked himself whether he
could ever have taken her by right of a vital need. His imagination
would not allow him to do so. He could only see himself for ever
kneeling, or delicately touching her as an exquisite privilege. He
could not again repeat the physical claim. Mere coveting had
prompted it. The soul had perished on his lips.
How instantly she had read the quality of his act. Every beat of the
quick moment of his taking her was minutely divided in his memory.
He felt again her surrender, her expectation of the kiss she could not
deny—the farewell moment of her youth to be expiated in years of
sacrifice. Then suddenly she had rebelled, feeling the soul go out of
him, protesting against her dishonour.
Peter quailed to think how he had tortured her. He knew now that
Lady Mary loved him. She had been outraged where most she was
virginal.
For a moment Peter caught at a hope that yet the mysterious rift
might close between the soul and body of his love. Must he always
be thus divided? Was he never to know a perfect passion where the
blood ran in obedient rapture to celebrate the meeting of two in
one? He remembered the beautiful girl he had tracked on a summer
night, to shrink from taking her because his spirit was her enemy.
Now that he in spirit loved Lady Mary—he insistently fought through
to-day's murk back to his adoration—he was still divided. His
moment of hope died out. He had no right to Lady Mary. He could
not passionately claim her. His passion would fail again, as to-night it
had failed, leaving only the senses to be fed.
He did not love her. Brutally it came to that. Lady Mary must take
the way she had herself appointed. She could not be asked to put
away the work of her life in return for a worship that fed upon the
air, or for a hunger that seized on a vanishing feast. Himself he felt
entirely in her hands. He hoped to be forgiven, and accepted as the
witness of her dedicated life. But he did not expect it, or make a
claim.
He reached Curzon Street at ten o'clock, and found his mother
returned from dining out. Mrs. Paragon now had her own friends.
She quietly came and went, usually not asking how Peter fared. All
his time was taken up with Lady Mary, and with Lady Mary she left
the issue in perfect trust. But to-night she was startled from her
assurance. Peter, unaware that he betrayed himself, had the face of
a soul newly admitted to damnation.
"What has happened to you, Peter?" she asked.
"Nothing, mother."
She came to him where he had flung himself into a chair beside the
fire.
"Has Lady Mary sent you away?"
Peter stared at her in amazement. He had never talked of Lady Mary.
But he always accepted his mother's mysterious knowledge.
"She is soon to be married, mother."
"Lord Wenderby?"
This was more than Peter could accept.
"You know that also?" he exclaimed.
"I saw Lord Wenderby one day in these rooms," said his mother
quietly. "I knew he was in love with Lady Mary."
Peter looked keenly at his mother.
"You are sure he loves her?" he asked.
"Quite."
"I should be happy to believe that. It gives him a better claim."
"Better than your own?" said his mother. She was at last surprised.
"I have no claim at all. I do not love Lady Mary."
He was quaintly wretched. His mother almost smiled. She saw a light
in the cloud, but it puzzled her. Would he then have preferred to love
Lady Mary and to lose her?
"Tell me what has happened," she said. "I don't understand. You do
not love Lady Mary—is that your trouble?"
"She told me of Lord Wenderby," Peter obediently answered, "and I
was mad at the idea of losing her. I grasped at her. I was like a wild
beast."
"But you do not love her," Mrs. Paragon persisted.
"It was not love made me behave like that. It was brutal. I had no
true passion at all. I disgusted her."
Mrs. Paragon suddenly rose.
"What has Lady Mary said? How did she part from you?"
Peter looked at her in wonder. What was his mother going to do
now?
"She said she would write," he answered. "Her eyes were closed."
Mrs. Paragon saw that this was not Peter's tragedy. She could leave
him to his remorse.
"Give me my cloak, Peter."
"Where are you going?"
Mrs. Paragon ignored his question.
"What is Lady Mary doing now?" she asked.
"She promised to wait for Antony. The division to-night is at eleven
o'clock."
Mrs. Paragon looked at the clock.
"It is now half-past ten. Call me a cab, Peter."
"You are going to her?"
"Of course."
On the way to Arlington Street Mrs. Paragon saw the radiant figure
of the woman, to whom she had trusted Peter, in dreadful eclipse.
She passed without a word Lady Mary's protesting servant, and went
directly to her room. Lady Mary still lay with closed eyes where she
had been struck down. Mrs. Paragon moved quietly towards her, and
gathered her like a child. She opened her eyes, accepting Peter's
mother with a clasp of the hand.
"You have seen Peter?" she quietly asked.
"He has just come home. He says he has for ever offended you."
Lady Mary smiled.
"I will send him a word to-night," she said. "I have just been trying
to understand. I think I shall soon be happy. I know now that Peter
does not love me. That makes it so much easier."
"He worships you," Mrs. Paragon insisted.
"Can that be restored?"
"More than ever now. I am sure he would want me to tell you that."
Lady Mary raised herself from Mrs. Paragon's shoulder and looked at
her.
"I cannot yet measure this breach in Peter. He has loved me from
the moment we came together at Highbury. But to-night I was
humbled. There was no love at all. I cannot now believe that Peter
will ever truly love. There is a rift."
"You are wrong," said Peter's mother.
Mrs. Paragon told Lady Mary how lately she had watched beside him
as he wandered in an empty house. Lady Mary heard the story of
Miranda.
"I think he is wandering still," concluded Peter's mother.
"You should have found this girl," said Lady Mary.
Mrs. Paragon paused a moment.
"I have tried," she said at last.
"Can't she be traced?"
"You remember the great liner that went down four years ago? She
was not on the list of people saved."
"When did you discover this?"
"I inquired shortly after Peter's illness."
Lady Mary thought a little.
"Perhaps it is better so," she said after a pause.
"Why do you say that?"
"Peter has surely grown away from these people. He would not have
found his dream."
A shutting door warned Lady Mary that her brother had returned.
She rose from the settee, and went to the writing table. When she
had finished her few lines, she gave them to Mrs. Paragon, who,
asking Lady Mary with a look, was invited to read them:

"Peter,—I beg you not to distress yourself. I am determined to


forget what happened this evening, and I rely on you not to
brood on things which are finished. You know now that I am
more than ever right to become the wife of Lord Wenderby. I
want you to meet me without awkwardness or self-reproach.
There is no need for one or the other. Nothing has changed.
"I am sending this by your dear mother.
"Mary."

Mrs. Paragon handed back the sheet.


"You are kind," she said.
"I have nothing to resent."
She sealed the letter, and addressed it. "When Peter has got over his
remorse, you will bring him back," she suggested.
"His remorse is too keen to last," Mrs. Paragon said quite simply. She
did not intend to be critical.
Lady Mary kissed Mrs. Paragon tenderly.
"It was beautiful of you to come," she whispered.
Peter was waiting for his mother, and met her anxiously at the door.
Lady Mary's letter acted as she intended. It was a dash of water
upon the fires of his despair. Reading her collected sentences, he
could hardly believe he had seen love and pain unutterable in her
eyes. She was, in her letter, restored to serenity as one to be
remotely worshipped. An added majesty had crowned her. She was
dedicated to a great historic part. Already as Mrs. Paragon returned,
the news was spread from waiting presses that the Government had
fallen. They screamed it in the street below. Now that his personal
passion was out of the way, Peter began to see these issues in a
large and national perspective. He remembered Haversham's vibrant
wish that he might have had some share in this event—the event of
which Lady Mary was motive and queen.
Peter's recovery was rapid. Alternately the week through he wavered
between the remorse of one who had erred unspeakably and the
exultation of one still privileged to witness the flight of an angel.
Then, one bright morning, he discovered that these extremes had
vanished in a quiet sense, that a chapter of his life had closed.
Rapture was going out of his late adventure, making way for a
steady sense that Lady Mary was very admirable and an excellent
friend.
After a few days spent mostly with his mother, he was enough in
tune with Lady Mary's letter to visit her in Arlington Street.
Wenderby was waiting for her, and, before she came down to them,
they were a few moments together. Peter was surprised at the
cordiality of his feelings for the man he had so long distrusted.
Wenderby had an instinct for meeting people in their own way. He at
once saw the change in Peter.
"I think you know of my engagement?" he said abruptly.
"Has Lady Mary told you everything?" Peter asked.
"Not everything," Wenderby answered with a faint smile. "I have
inferred the greater part."
"You will be very proud of her," said Peter impulsively.
"You believe that I understand my good fortune?"
Lady Mary came in as they spoke. Peter was astonished at the ease
with which they talked together of small things. He tranquilly
withdrew at the end of a few moments. Lady Mary was frank and
free. She seemed entirely at peace. There had not been a sign of
effort in her friendly greeting.
XXXVII
In the following months Peter realised to what extent his late
devotion to Lady Mary had filled him. Now that she was only one of
his best friends, he was at first vacant of enthusiasm. Then he
began to discover all kinds of neglected ties with people whom
before he had hardly noticed. Ostensibly Lady Mary was still
supreme, but, curiously as it seemed to Peter, though her sacrifice
and the wonder of her great career set her higher in his admiration,
it had made this admiration less tremulously personal. The ecstasy
had gone out of it. It no longer shut out the undistinguished world.
He discovered now that he had other friends; that he was liked by
some of them; that their liking was gratifying and merited some
small return.
Since Haversham had been claimed by his public and hereditary life,
Peter had become attached to a frequent visitor at Arlington Street.
James Atterbury was a young and successful caricaturist who had
also written and produced several plays. His activities were
financially unnecessary, so that in a sense he was an amateur. He
was socially popular, and Peter met him everywhere. Gradually he
had taken Haversham's place. Like Haversham, he was tolerant and
urbane. He had long abandoned those visions which now were
driving Peter restlessly from day to day. He was a cheerful man of
pleasure, living for all that was agreeable and could be decently
enjoyed. He had watched, with respectful irony, Peter's absorbed
devotion to Lady Mary, and had keenly speculated as to how it would
end. When the end came, Haversham plainly hinted that Atterbury
would do well to help Peter recover an early interest in people and
things.
"Certainly," Atterbury had said. "I'm rehearsing a new play at the
Vaudeville. Peter shall attend."
"Is that adequate, do you think?"
"Yes, Tony. Rehearsing a play is the most distracting thing in the
world."
So Peter, plunged into a new atmosphere, sat for hours upon the
small stage at the Vaudeville watching, with growing interest and
amusement, the pulling together of a mixed company.
"It's like a children's party," Atterbury told him. "At present we are a
little shy, but soon it will be a bear-garden. They will forget that I am
the author, to be loved and respected. By the time we are ready for
the public, I shan't be on speaking terms with anybody."
"Except Vivette," suggested Peter, looking towards Atterbury's
principal lady.
"You've noticed Vivette?"
"I've noticed you always give way to her."
"Not always."
"Usually, then."
"Usually she is right. She is really improving my play."
Peter looked with greater interest at the vivacious young woman
now holding the stage. She was full of vitality, which somehow she
shared with all who acted with her. As soon as she left the stage, life
went out of the performance.
"What is her name?" Peter asked.
"Formally you may call her Mademoiselle Claire."
"French?"
"Every country in the world."
At this point the rehearsal again became animated. Atterbury was
soon fighting to be heard. The dispute was at last arranged, and he
returned to Peter.
"Vivette has been looking at you, Peter," he said as the play began
to go smoothly again.
"How do you know?"
"Because she has told me."
"What did she say?"
"She asked for the name of my solemn friend."
"Anybody looks solemn beside you," Peter grumbled.
He resentfully examined his companion. Atterbury was roseate and
sanguine; but he looked at Peter as gravely as he could.
"I hope you are not hankering after the admiration of Vivette," he
said. "She isn't safe."
"What do you mean?" asked Peter.
"She looks upon everything nice in life as a sort of sugar-plum. If
she likes you, Peter, she will eat you."
"You mean she is a wicked woman?"
"Not at all," twinkled Atterbury. "I mean she is a small child who
happens to be greedy. She would think no more harm of making a
hearty meal of your ingenuous self than I should of swallowing an
oyster."
Vivette slipped from the imaginary door of a room that did not exist
—they were rehearsing without scenery—and came to them before
they were aware.
"You have shocked your friend," she said to Atterbury, looking at
Peter. Peter angrily composed his protesting face, as Atterbury
presented him.
"Peter Paragon is easily shocked," Atterbury said. "I hope you did
not hear what we were talking about?"
"No."
"It was harmless," Atterbury assured her.
"Do tell me," she pleaded. "I don't often hear anything harmless."
"Impossible."
"Wasn't it to do with oysters? Let's go to lunch. We shan't make any
way this morning."
They lunched together. It was an agreeable triangle; but Atterbury,
with amusement, saw he would soon be unnecessary. Peter, in
reaction from the emotional strain of his last adventure, found in
Vivette a pleasant holiday. Peter consented with Vivette to relieve
the dignity and stress of life upon the heroic plane. He came to
delight in the quick gleam of her eyes.
The eyes of Vivette were brown, easily lighting, but shallow. They
flickered into fun, and went suddenly out. They could never be
passionate or deep, but they talked with him, and drew him to
admire the play of her lips, slightly full, the life and light of her face;
the sudden tale of her blood which came and went at a word or
gesture.
She did everything with an equal enthusiasm. She had the mimic
soul to catch at every mood. She was born a player. Life was a quick
succession of happy parts. She stepped from her rôle on the stage
into the rôle she happened to be playing in the world.
Soon she was playing the happy comrade of Peter. He soon attended
rehearsals regularly without prompting from Atterbury, and Atterbury
usually made excuses to send them away to a friendly lunch.
Atterbury was unable to resist the comedy of seeing them together.
They inspired the most famously cruel of his social caricatures. Peter
looked forlornly innocent beside her. Cytherea's Pilgrim, Atterbury
named him. His simplicity and perpetual fervour aggravated the
lightness of Vivette. In Atterbury's penetrating eye, each made a
caricature of the other. It was a sense of this which threw them
more and more closely together. Each was determined to touch the
other and to make a proselyte. Peter wanted to be taken seriously
by Vivette. Vivette wanted to see Peter come down from his golden
throne.
Peter watched the first performance of the play from a box with his
mother. Later he attended, without his mother, a supper party in the
rooms of Vivette—a rambling flat among the chimneypots of Soho.
She was bright with laughter and success, and Peter frowned to
observe how easily she caught the mood of her company. He felt he
would like to say or do something to bring depth into her eyes.
Peter and Atterbury were the last to leave, and they sat for a while
to enjoy a friendly conversation. Vivette curled herself up.
"This is heavenly," she purred. "I simply love peace and quietness."
"I've noticed it," said Peter bitterly, surveying a litter of empty
champagne bottles on the table behind them.
"Don't, Peter. You are spoiling the beautiful silence. Besides, your
views are all wrong. The only people who really understand peace
and quietness are people who also like a jolly good racket. We get it
both ways."
"You always do," said Atterbury. "Life is the art of getting it both
ways—eh, Vivette?"
"Not worth living," grunted Peter.
"That's your ignorance, Peter," said Vivette. Her eyes suggested a
wicked godmother. "I don't know what's going to become of Peter,"
she added confidentially to Atterbury.
"You are really anxious?"
"Naturally. Peter's a temptation to all of us. He is so aggressively
pure."
"You, at any rate, are safe," Atterbury audaciously hoped.
"For the time being," Vivette reassured him, "if Peter will only smile
now and then. But he mustn't go on wearing his beautiful character
like a medal."
Peter had bounded to the far end of the sofa. Now he rose, offering
to go.
"You want to discuss me," he said.
"It doesn't matter, thank you; but if you really must—" Vivette held
out her hand politely. Peter smacked it suddenly. Then he sat down
again.
"What a wicked child," said Vivette, turning again to Atterbury. "Did
you ever see such a temper? It's a curious thing about me," she
added, discussing an interesting problem in character, "every man I
have anything to do with sooner or later wants to hit me."
"Men like to be taken seriously."
"You never want to be taken seriously, do you, Jimmy?"
"I am not a typical man," retorted Atterbury.
"My men are never typical," said Vivette. "I hate typical men. I'm
sure Peter isn't typical."
"He'll get there some day," Atterbury assured her.
"Not as far as that," she quickly hoped.
For the first time Peter detected a note of sincerity in her. He turned
and found her jealously perusing him. He faintly coloured, and this
time he really went.
After he had left them, Vivette and Atterbury looked intelligently at
one another.
"I really mean it," she said at last. "I shouldn't like Peter to be a
typical man."
"It will depend on his luck."
"You mean he must fall into the right hands?"
"When he does fall."
He looked at her keenly, and she coloured under his inspection.
"He mustn't fall into the hands of a nasty woman," she said.
"You would rather take him yourself?" Atterbury thoughtfully
suggested.
"Sometimes, Jimmy, you are too familiar."
"I'm sorry," said Atterbury, beginning to look for his hat. "Let me
thank you again for your beautiful acting. You saved my play to-
night."
XXXVIII
In the coming months Peter met many of the friends of Vivette. He
at once became enthusiastic, and insisted to Atterbury that they
were much maligned by superior people. Atterbury agreed.
"They're the best-hearted people in the world," he said—"quite
perfect if you don't have to do business with them."
"So genuine," Peter exclaimed.
"Very genuine," Atterbury echoed. "They always mean what they
say. Of course they never mean the same thing for two days. But
that only makes them more interesting."
He looked, as he said this, hard at Peter, and Peter flushed, knowing
how justly he himself might be classed with enthusiastic people who
change and range with the time. Why had he suddenly lost interest
in the friends of Haversham and Lady Mary? He simply did not want
to go on with them. He was caught up in this other set, and at heart
he knew that his pleasure in these strangers was a dereliction. Their
charm was superficial, their posturing was frequently half-bred. He
realised that he was declining, through weariness, to a less excellent
carriage of himself. He was unhappy and restless—tired enough to
take and enjoy the second best.
Atterbury's play lived through the summer and the autumn season.
It outlived many great events—among them a general election which
put in the Tories, and the marriage of Lady Mary with Lord
Wenderby, then First Lord of the Admiralty.
As Peter stood in St. Margaret's watching the ceremony he could
hardly believe that he had ever had a part in this great affair. It
seemed that lately he had gradually come down to a pleasant valley.
It was incredible that he had ever breathed high air with the radiant
woman who now was the wife of the most powerful man in England.
Lady Mary's marriage made Peter think. Already Vivette was an
obsession, serious enough to be noticed by his friends, and to
interfere with his work. Peter began to be frightened, and secretly
ashamed. His last years seemed all to be bound up with women.
Was he never to be free of his foolish sensibility? Was he to fall
helplessly from figure to figure as opportunity called him? There was
work to do, but his fancy was perpetually caught and held in one
monotonous lure.
Lady Mary had shown him there were other ends to follow than a
personal and perfect mating. He was beginning to feel haunted.
There was a murk in his brain—into which thoughts sometimes
intruded which he found, in clear moments, to be shabby. They
prompted him intimately towards Vivette. Perhaps it would give him
peace if once for all he pricked the bubble of his expectation. Why
should he not test this vision; pierce rudely in, and pass on? Sex was
not all, and if here he fell short of perfection, it was no great matter.
He could leave that dream behind, no longer urged about it in a
weary circle.
He felt at first that this impulse towards weak submission was
treason to a secret part of himself that seemed to be waiting,
seemed also to know that perfection would come and must find him
virginal. But this feeling was less strong with the passing time. He
came more and more to cherish the idea of Vivette. Her changing
eyes became his only mirror wherein to look for an answer to his
question, and when he did not find the answer he began stormily to
wonder whether their cryptic shallows might not surrender the
secret he desired if adventurously he dived deep enough.
This mood always found and left him deeply out of heart. It was part
of a general feeling that he was gradually breaking down.
Sometimes, in defence, it flung him to an extreme of carefully
induced exaltation. When temptation whispered that Vivette was a
pleasant creature, and would allow his love, he insisted, to justify his
impulse to take her, that surely she must perfectly be his mate. His
unconquerable idealism, weakened and gradually beaten down,
required that he should thus deceive himself.
Through the winter—Atterbury's play still lingered—they frequently
spent Sunday evening together in her Soho flat. Vivette alternated
between fits of extreme physical energy—when she took exercise in
every discovered way—and complete inertia. Midwinter found her at
the close of her hibernating—"lying fallow for the spring," she
described it. She passed her Sundays curled up in a deep settee by
the fire. Peter spent long, drowsy afternoons and evenings reading
with her, dropping occasional words, eating light food prepared by a
cook who understood that her mistress must on no account be
served with anything which required her to sit upright. Peter, who
earlier in the year had ridden, rowed, and played tennis with Vivette,
did not in the least like her present habits.
Upon a Sunday evening in February he discontentedly began to wait
on her at supper.
"Dormouse," he called from the table, "what are you going to drink?"
To his surprise Vivette suddenly sat up:
"Champagne to-night. I'm going to be full of beans. I shall do
Swedish drill in the morning."
"Not a day too soon," grumbled Peter. "I wonder you can stand it,
eating butter and cream all day and lying on your back. You must
have the liver of a horse."
"You are right," she retorted. "People pretend to despise me for
being lazy. It's envy, Peter. Everybody would be lazy in the winter if
their health would stand it."
She pushed away a plate of delicate soufflé.
"Not to-night, Peter. I'm going to eat some meat."
"I often wonder about you," said Peter.
"Really?"
"Do you do nothing with your whole heart, or everything?"
"Everything," said Vivette, with her mouth full.
"I don't believe anything really touches you."
Peter was trying to be serious.
"You are forgetting the champagne," she interrupted.
Peter went to the cupboard, brought out a bottle and exploded it.
"Thank you, Peter. There's nothing in the world like the pop of a
champagne cork. It makes me think."
"Think?" said Peter, with his nose in the air.
"Yes," she insisted. "It makes me think how nothing matters at all,
or how everything matters tremendously. I don't know which."
"I hate champagne," said Peter viciously.
"Of course."
"Why 'of course'?"
"There's something which doesn't fit in your popping a champagne
cork. It's like laughing in church."
"Champagne is vulgar. It's only good for a bean-feast."
"You're going to have some, I suppose?" She looked at him in a way
that spoke between the lines of her question.
Peter hated the challenge of her light inquiry. He wanted to deepen
it. In many small ways Vivette had held herself out to Peter, but she
did not seem to care what he would do.
He poured himself some wine and drank to her.
"This is excellent champagne," he said brightly. Then he drooped. "It
isn't my stuff," he added.
"I love it. Pop—and it's all over."
"It goes flat in the glass."
"Just for a moment it's perfect."
"The present, I suppose, is all that matters?" said Peter, heavily
censorious.
"Why not?" she slanted her amusement at Peter, and delicately
crushed the bubbles of her wine.
"Have you ever taken anything seriously in your life?" asked Peter.
"I have never inquired."
Her eyes flickered. Their wavering light exasperated his desire to
move her deeply, to hold for a moment her nimble spirit that ran at
a touch like quicksilver. She felt his rising passion, and her mimic
soul responded under the surface of her laughter. She did not stir
when Peter came near and took her by the shoulders. Her eyes were
still the familiar changing shallows. They raised in Peter an ambition
to see them deepen and burn.
"I would like to see you really meaning something," he said,
tightening his grip upon her. "You are only a reflection. I want to see
your own light shining."
"Is this a poem, Peter? Or are you trying to save my soul?"
Would she never be serious? Peter was angry and miserable. His late
brooding came to a point. He wanted to touch Vivette, and he
wanted an excuse. He could not play her light game of pleasure
without insisting that it was something more.

You might also like