100% found this document useful (3 votes)
49 views

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

The document is about the second edition of 'Learning React: Modern Patterns for Developing React Apps' by Alex Banks and Eve Porcello, which aims to teach developers the React library and modern JavaScript techniques. It covers foundational topics such as state management, React Router, testing, and server rendering, while also providing hands-on examples and resources. The book is designed for both beginners and those looking to enhance their React skills, emphasizing practical application and understanding of the React ecosystem.

Uploaded by

elbafettah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
49 views

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

The document is about the second edition of 'Learning React: Modern Patterns for Developing React Apps' by Alex Banks and Eve Porcello, which aims to teach developers the React library and modern JavaScript techniques. It covers foundational topics such as state management, React Router, testing, and server rendering, while also providing hands-on examples and resources. The book is designed for both beginners and those looking to enhance their React skills, emphasizing practical application and understanding of the React ecosystem.

Uploaded by

elbafettah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

Learning React: Modern Patterns for Developing

React Apps, 2nd Edition (eBook PDF) instant


download

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

Download more ebook from https://ebooksecure.com


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

Learning React: Modern Patterns for Developing React


Apps, 2nd Edition (eBook PDF)

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

(eBook PDF) Instructional Patterns: Strategies for


Maximizing Student Learning

http://ebooksecure.com/product/ebook-pdf-instructional-patterns-
strategies-for-maximizing-student-learning/

(eBook PDF) Reflections: Patterns for Reading and


Writing 2nd Edition

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

(eBook PDF) Patterns of Modern Chinese History by


Charles A. Desnoyers

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

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

(Original PDF) Learning for Teaching, Teaching for


Learning with Student Resour

http://ebooksecure.com/product/original-pdf-learning-for-
teaching-teaching-for-learning-with-student-resour/

(eBook PDF) Developing Content Area Literacy: 40


Strategies for Middle and Secondary Classrooms 2nd
Edition

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

Business Communication: Developing Leaders for a


Networked World 2nd Edition Peter W. Cardon - eBook PDF

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

(eBook PDF) Patterns of World History Combined Volume


2nd edition

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

i. Create React App and Testing


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

Modern Patterns for Developing React Apps

Alex Banks and Eve Porcello


Learning React

by Alex Banks and Eve Porcello

Copyright © 2020 Alex Banks and Eve Porcello. All rights reserved.

Printed in the United States of America.

Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North,


Sebastopol, CA 95472.

O’Reilly books may be purchased for educational, business, or sales


promotional use. Online editions are also available for most titles
(http://oreilly.com). For more information, contact our
corporate/institutional sales department: 800-998-9938 or
[email protected].

Acquisitions Editor: Jennifer Pollock

Development Editor: Angela Rufino

Production Editor: Kristen Brown

Copyeditor: Holly Bauer Forsyth

Proofreader: Abby Wheeler

Indexer: Judith McConville

Interior Designer: David Futato

Cover Designer: Karen Montgomery


Illustrator: Rebecca Demarest

May 2017: First Edition


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

See http://oreilly.com/catalog/errata.csp?isbn=9781492051725 for


release details.

The O’Reilly logo is a registered trademark of O’Reilly Media, Inc.


Learning React, the cover image, and related trade dress are trademarks
of O’Reilly Media, Inc.

The views expressed in this work are those of the authors, and do not
represent the publisher’s views. While the publisher and the authors
have used good faith efforts to ensure that the information and
instructions contained in this work are accurate, the publisher and the
authors disclaim all responsibility for errors or omissions, including
without limitation responsibility for damages resulting from the use of
or reliance on this work. Use of the information and instructions
contained in this work is at your own risk. If any code samples or other
technology this work contains or describes is subject to open source
licenses or the intellectual property rights of others, it is your
responsibility to ensure that your use thereof complies with such
licenses and/or rights.

978-1-492-05172-5
[LSI]
Preface

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

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

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


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

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

Conventions Used in This Book


The following typographical conventions are used in this book:

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

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

Constant width bold


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

TIP
This element signifies a tip or suggestion.

NOTE
This element signifies a general note.

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

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


please send email to [email protected].

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

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


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

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

O’Reilly Online Learning


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

Our unique network of experts and innovators share their knowledge


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

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

O’Reilly Media, Inc.

1005 Gravenstein Highway North

Sebastopol, CA 95472

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

707-829-0515 (international or local)

707-829-0104 (fax)

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

Email [email protected] to comment or ask technical


questions about this book.

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

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

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

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

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

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

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

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


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

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


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

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

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

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

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

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


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

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

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

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

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

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


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

React’s Past and Future


React was first created by Jordan Walke, a software engineer at
Facebook. It was incorporated into Facebook’s newsfeed in 2011 and
later on Instagram when it was acquired by Facebook in 2012. At
JSConf 2013, React was made open source, and it joined the crowded
category of UI libraries like jQuery, Angular, Dojo, Meteor, and others.
At that time, React was described as “the V in MVC.” In other words,
React components acted as the view layer or the user interface for your
JavaScript applications.
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.
Another Random Document on
Scribd Without Any Related Topics
primitive dread of menstruous, ii. 238-241

Blood-drinking, inspiration by, i. 34, 35

Boba, a name given to the last sheaf, i. 340, 341

Boeotians of Plataea, festival of the, i. 100-103

Boeroe, ceremony at the rice harvest in, ii. 71

Bohemian midsummer custom, i. 79; ii. 259;


Mid-Lent custom, i. 82;
Whit Monday custom, i. 91, 244-247;
ceremony of carrying out Death, i. 258-260;
superstition regarding death, i. 260;
ceremony of bringing back summer, i. 263;
harvest custom, i. 340;
white mice spared in Bohemia, ii. 131, 132;
superstition held by poachers in Bohemia, ii. 288

Böhmer Wald Mountains, custom of the reapers in the, ii. 15

[pg 388]

Bolang Mongondo, recapture of the soul in, i. 131;


preservation of cut hair, i. 203;
ceremony at rice harvest in, ii. 71, 72

Bombay, soul superstition in, i. 127

Bones of animals not broken by savages, ii. 124

Boni, king of, and his courtiers, i. 222, 223

Booandik tribe superstition concerning the blood of women, i. 186

Book of the Dead, i. 312


Bormus, the name given to the lament of the Bithynian reapers, i.
365, 398

Borneo, custom in, regarding infested persons, i. 154

Bouphonia, the, ii. 38-41

Brabant, North, Whitsuntide custom in, i. 88

Brahman soul story, i. 128, 129;


sin eaters, ii. 156

Brahmans, temple of the, i. 230;


transference of sins by the, ii. 200

Brandy, North American Indian theory about, ii. 87

Brazilian Indians, self-beating by the, ii. 215, 216;


treatment of girls at the age of puberty by the, ii. 231, 232

Bresse, May customs in, i. 98;


ceremony regarding the last sheaf, i. 408

Brest, fire festival at, ii. 261

Breton peasant and the wind, i. 30

Briançon, May-day in the neighbourhood of, i. 95;


harvest ceremony at, ii. 11

Bride, a name given to the binder of the last sheaf, i. 345

Brie, May-day custom in, i. 84;


harvest custom in, i. 370, 375;
burning of mock giant in, ii. 282

Britanny, reaping custom in, i. 335, 336;


midsummer fires in, ii. 261
British Columbia, fish ceremony by the Indians of, ii. 121

Bruck, harvest custom in, i. 333, 334

Brüd's bed in the Highlands, i. 97

Brunnen, Twelfth Night custom at, ii. 182

Brunswick, Whitsuntide customs in, i. 90

Buddhist animism, i. 59

—— Tartar worship, i. 42, 43

Buffalo, belief in the resurrection of the, ii. 123;


held sacred by the Todas, ii. 136, 137

—— bull, ii. 19

Bulgarian rain-charm, i. 16;


custom at the laying of a foundation stone, i. 144;
harvest custom, i. 341

Bull, Dionysus as a, i. 325, 326; ii. 37-44;


the corn-spirit as a, ii. 19-24;
Osiris and the, ii. 59-61;
sacred, ii. 60;
as a scapegoat, ii. 200, 201

Burghers, first seed sowing and reaping amongst the, ii. 72;
transference of sins by the, ii. 151, 152

Burgundian kings deposed in times of scarcity, i. 47

Burma, mode of executing princes of the blood in, i. 180;


head-washing in, i. 188, 189;
mock burial in time of sickness in, ii. 84;
ceremony of driving away cholera in, ii. 161;
offering of first-fruits in, ii. 374

Burmese and the soul, i. 130

Burnt sacrifices among the Celts, ii. 278-280

Buro Islands, dog's flesh eaten in the, ii. 87;


disease boats, ii. 187

Burying alive, i. 217

Busiris, legend of, i. 400, 401

Butterfly, the Samoans and the, ii. 56

Buzzard, sacrifice of the sacred, ii. 90-92

Byblus, lamentation for the death of Adonis at, i. 280

Calabria, expulsion of witches in, ii. 181

Calcutta, iron-charm used in, i. 176

Calf, the corn-spirit as a, ii. 19-24

Calicut, kings killed at the expiry of twelve years in, i. 224, 225

Californian Indians, their opinion of the dust columns, i. 30

—— sacrifice of the buzzard, ii. 90, 91

Caligula, i. 4

Callander, Beltane fires in, ii. 254, 255

Cambodia, search for inspired man in time of epidemic in, i. 36;


kings of fire and water in, i. 53-56;
its sacred tree, i. 67;
kings of, i. 118;
touching the king's body in, i. 172;
man's head not touched in, i. 189;
ceremony at the cutting of the king's hair in, i. 197;
temporary kings of, i. 228;
the Stiens of Cambodia and the killing of animals, ii. 115;
expulsion of evil spirits, etc. in, ii. 178, 184;
seclusion of girls in, ii. 235

Cambridgeshire, harvest custom in, i. 341, 342

Cameroons, the life of a person supposed to be bound up with that


of a tree by the, ii. 329

Canadian Indians, detention of the soul amongst the, i. 139;


beaver hunting by the, ii. 116, 117

Candlemas Day customs, i. 97; ii. 29, 48

[pg 389]

Canelos Indians, their belief of the soul in the portrait, i. 148

Cannibalism, ii. 88, 89

Capital offences, i. 162, 190

Carcassonne, hunting the wren in, ii. 143, 144

Caribs, the, belief in the plurality of souls, ii. 339

Carinthia, ceremonies on St. George's Day in, i. 84, 85;


ceremony at the installation of a prince of, i. 232, 233

Carmona, custom in, ii. 184, 185

Carnival, ceremony of burying the, i. 244, 252-257, 270, 272


Carnival Fool, i. 256

Carpathus islanders, reluctance to have their likenesses drawn, i.


148, 149;
transference of sickness by the, ii. 154

Cashmere stories, the external soul in, ii. 302-304

Cat, the corn-spirit as a, ii. 11, 12;


burnt, ii. 283

Caterpillars, method of freeing a garden from, ii. 130

Cattle, trees and, i. 72 sq.;


driven through the fire, ii. 273

Cedar, the sacred, of Gilgit, i. 69

Celebes, the, and the soul, i. 123-125;


custom regarding infested persons, i. 154;
superstition regarding the knife, i. 177;
blood not spilt on the ground by the, i. 182;
custom at a birth, ii. 329;
harvest festival, ii. 376

Celtic human sacrifices, ii. 278-284;


the external soul in Celtic stories, ii. 313, 314

Ceram, rain-making in, i. 13;


superstition regarding the blood of women in, i. 187;
hair cutting superstition in, i. 194; ii. 328;
disease boats in, ii. 185, 186;
ceremony in epidemic, ii. 187;
seclusion of girls in, ii. 229;
initiation ceremony, ii. 354-356

Chaeronea, human scapegoat in, ii. 210, 211


Chambéry, threshing ceremony at, ii. 23

Chedooba, ceremony on felling a tree in the island of, i. 64

Cheremiss, expulsion of Satan by the, ii. 180, 181

Cherokee Indians, purification festival of the, ii. 166, 167

Chester, procession of mock giant at, ii. 281

Chibchas, weather kings of the, i. 44

Children sacrificed by their parents, i. 235-237

Chile, preservation of cut hair in, i. 204

China, emperors of, offer public sacrifices, i. 8;


rain-charm in, i. 18;
emperor held responsible for drought, etc., i. 49;
abstention from knives after a death in, i. 177;
ceremony to welcome the return of spring in, ii. 42, 43;
special seat of courage amongst the Chinese, ii. 87;
cannibalism in, ii. 89;
human scapegoat in, ii. 191;
festival of the aboriginal tribes of, ii. 193

Chios, rites of Dionysus at, i. 329

Chippeways, seclusion of women amongst the, ii. 239, 240

Chiriguanos, seclusion of girls by the, ii. 231

Chitomé, the, i. 113-115;


not allowed to die a natural death, i. 217, 218

Cholera, driving away, ii. 161, 189, 191

Chontal Indians, the nagual amongst the, ii. 333


Christian, Captain, shooting of, i. 181

Christmas customs, i. 60, 334; ii. 6, 7, 29-31, 141, 142, 144

Chrudim, ceremony of carrying out Death at, i. 259, 260

Chuwash, the, test of a suitable sacrificial victim, i. 36

Circassians, the pear-tree believed to be the protector of cattle by


the, i. 73

Circumcision, i. 171

Clucking-hen, ii. 8

Cobern, fire festival at, ii. 250

Cobra Capella, sacrifice of the, ii. 94, 95

Cock, the corn-spirit as a, ii. 7-10

Columbia River, Indians of the, and the salmon, ii. 121, 122

Comanches, rain-charm used by the, i. 18

Compitalia, festival of the, ii. 83

Congo belief in the souls of trees, i. 60;


the Chitomé in the kingdom of, i. 113;
negroes and soul selling, i. 139;
initiatory rites in the valley of the, ii. 345, 346

Coorg rice-harvest ceremonies, ii. 72, 73

Corea, kings of, confined to their palaces, i. 164;


may not be touched, i. 172;
tigers' bones valuable in, ii. 87
Corn drenched as a rain-charm, i. 286;
double personification of the, i. 358, 359;
reaper, binder, or thresher wrapt up in corn, i. 370, 371

—— baby, ii. 23

—— goat, ii. 13, 14

—— mother, i. 232, 233;


a prototype of Demeter, i. 356

[pg 390]

Corn queen, i. 341

—— spirit, the, as the grandmother, etc., i. 336-343;


as youthful, i. 343-346;
death of, i. 363, 364;
binding persons in sheaves as representatives of the, i. 367-
372;
pretence of killing the, or its representative, i. 372-380;
represented by a stranger, i. 375-380;
represented by a human victim, i. 390-395;
how the representative is chosen, i. 393;
as an animal, ii. 1-67;
as a cock, ii. 7-10;
as a hare, ii. 11;
as a cat, ii. 11, 12;
as a goat, ii. 12-17;
as a bull, ii. 19-24;
as a calf, ib.;
as a cow, ii. 20, 21;
as a mare, ii. 24, 25;
as a horse, ii. 26;
as a pig, ii. 26-31;
parallelism between the anthropomorphic and theriomorphic
conceptions of the, ii. 32;
death of the, ii. 33;
suggested explanation of the embodiment of the, in animal
form, ii. 34;
the ox as the embodiment of the, ii. 41-43

—— wolf, ii. 3-7, 30

—— woman, i. 342, 343

Cornwall, May-day custom in, i. 75;


midsummer bonfires in, i. 101; ii. 262;
reaping cries in, i. 407

Corsica, midsummer fires in, ii. 266

Cough, cure for, ii. 154

Court ceremonies, i. 22, 23; ii. 88

Cow, the corn-spirit as a, ii. 20, 21;


sacred, ii. 61;
man in cow's hide, ii. 145, 146;
cow as a scapegoat, ii. 200, 201

Cracow, harvest customs in, i. 340

Crannon, rain-charm at, i. 21

Creek Indians, festival of the first-fruits amongst the, ii. 75-78;


opinions held regarding the properties of various foods amongst
the, ii. 85, 86;
seclusion of women by the, ii. 239

Crete, sacrifices in, i. 173;


festival of Dionysus in, i. 324;
worship of Demeter in, i. 331

Croatia, beating in, ii. 216


Crocodiles spared from fear of the vengeance of other crocodiles, ii.
109

Crops, kings and priests punished for the failure of the, i. 46-48;
human sacrifices for the, i. 383, 384;
ceremonies at the eating of the new, ii. 69, 71;
sacramental eating of the new, ii. 68-77

Crying the Neck, i. 405-408

Curka Coles of India, their belief that the tops of trees are inhabited,
i. 65

Curse, ceremony of making the curse to fly away, ii. 150, 151

Cyzicus, construction of the council chamber of, i. 174

Dacotas and the resurrection of the dog, ii. 123

Daedala, festival of the, i. 100-103

Dahomey, king of, a capital offence to see him eat, i. 162

Damaras, custom of the, after travel, i. 158;


blood of cattle not shed by the, i. 182

Danae, ii. 237

Danger Islanders, soul snare used by the, i. 138, 139

Danzig, burying of cut hair in, i. 202;


reaping custom, i. 333;
harvest ceremony, i. 367, 368

Dards, the, rain-charm, i. 19

Darfur, veiling the sultan of, i. 162;


the sultans and their courtiers, i. 222;
the liver thought to be the seat of the soul in, ii. 88

Darowen, midsummer bonfires at, ii. 262

Dead Sunday, i. 254, 260

Death, preference for a violent, i. 216, 217;


superstition concerning, i. 260;
“carrying out,” i. 257-261, 264-271; ii. 207;
driving out, i. 258, 259, 272, 276;
in the custom of “carrying out” Death is probably a divine
scapegoat, ii. 206-208;
ceremonies at the burying of, ii. 250;
effigy of, i. 257 sq.

Debden, May Day custom in, i. 76

Deer, regard for, ii. 117, 118

Deities, reduplication of, i. 360-362

Demeter, the corn mother, i. 331, 332;


festivals of, ii. 44-47;
as a pig, ii. 44-49;
legend of the Phigalian, ii. 49;
representation of the black, ii. 49;
and Proserpine, myth of, i. 330, 331;
probable origin of, i. 355 sq.;
prototypes of, i. 356, 357

Demons, the soul carried off by, i. 132-135

Denderah, tree of Osiris at, i. 308

Denmark Christmas customs, ii. 29, 30;


midsummer bonfires, ii. 289
Devils, ceremony at the expulsion of, ii. 151, 158, 159-162, 170-185,
192, 193, 203;
represented by men and expelled, ii. 183-185

Devonshire reaping cries, i. 405, 406;


rain-charm, i. 408;
cure for cough, ii. 154

Diana, rule of the priesthood of, i. 2, 3, 6;


ceremonies at the festival of, i. 5;
Arician Grove said to be first consecrated to her by Manius
Egerius, i. 5;
a tree goddess, i. 105

Diana's mirror, i. 1

[pg 391]

Dieyerie of South Australia, rain-making by the, i. 20;


tree superstition amongst the, i. 62

Dingelstedt, harvest custom at, i. 371

Dionysus, marriage of, i. 104;


titles of, i. 320, 321;
myth of, i. 322-325;
rites of, i. 324, 329; ii. 43-46, 90;
rites of, similar to those of Osiris, i. 319, 320;
as an animal, i. 325-327, ii. 34-38;
association of, with Demeter and Proserpine, ii. 37

Diseases sent away in boats, ii. 185-189, 192 sq.


Divine beasts, i. 48

—— king, dependence of nature upon the, i. 109

—— kings, i. 49;
care taken of, i. 115;
cease to govern, i. 118, 119

—— kings and priests, burdensome observances placed upon, i. 110-


118;
effects of these burdens, i. 118-120

—— Man as scapegoat, ii. 201, 205

—— persons, seclusion of, ii. 242, 243

—— spirit, transmigration of, i. 42-44

Divining rods made from the mistletoe, ii. 367

Dog, the corn-spirit as a, ii. 3-7;


the flesh of the, eaten, ii. 87;
resurrection of the, ii. 123;
used as a scapegoat, ii. 194, 195

Domalde, King of Sweden, sacrificed, i. 47

Douai, annual procession at, ii. 280

Dreams, festival of, ii. 165, 166

Druids, oak-worship of the, i. 58


Dublin, May Day custom in, i. 101

Duk-duk, the, ii. 352 sq.

Duke of York Island, fishing ceremony by the natives of, ii. 120

Dulyn, i. 15

Dunkirk, annual procession at, ii. 280, 281

Dust columns, i. 30

Dutch criminals, cutting the hair of, to enforce confession, ii. 328

Dyaks, belief in the souls of trees amongst the, i. 59, 60;


abduction of the soul, i. 132, 133;
restoration of the soul, i. 138;
harvest custom, i. 68, 69, 353, 354;
the Dyaks and bad omens, ii. 151;
custom in epidemic, ii. 84;
may not eat venison, ii. 86, 87;
spare the crocodile, ii. 109;
Dyaks and the palm-tree, ii. 329;
festival of first-fruits, ii. 376

East Indian Islands, supposed cure for epilepsy in the, ii. 148, 149

Easter customs, i. 272, 276, 334; ii. 29, 181, 216, 217

—— fires, ii. 251, 252

—— Islanders, blood of an animal not shed by the, i. 182, 183;


offerings of first fruits, ii. 381

Eating animals to get their qualities, ii. 85-89

—— the god, ii. 67-90


—— and drinking, precautions taken at, i. 160-162

Edersleben, midsummer fire festival in, ii. 262

Efugaos, cannibalism by the, ii. 88

Egeria, i. 5

Egypt, beasts responsible for the course of nature in Upper, i. 48;


Egyptian kings deified, i. 49, 50;
Egyptian kings blamed for failure of crops, i. 50;
ancient Egyptian kings did not drink wine, i. 184, 185;
temporary-rulers in Upper Egypt, i. 231;
custom of burning red-haired men by the ancient Egyptians, i.
307;
religion of ancient Egypt, i. 313;
Egyptians and the pig, ii. 52, 53, 56, 57;
the bulls Apis and Mnevis worshipped, ii. 60;
sacred cattle in Egypt, ii. 60, 61;
sacrifice of the ram in, ii. 92, 93;
Egyptian type of sacrament, ii. 134-136;
Egyptian scapegoat, ii. 200;
the external soul in Egyptian story, ii. 315-318

Eifel mountains, fire festival in the, ii. 247, 248;


harvest omens in the, ii. 271

Eisenach, ceremony of bringing back summer in, i. 263;


ceremony of carrying out death in, ib.

Elan, regard for the, ii. 117, 118

Elephant, ceremony at the killing of an, ii. 113-115

Eleusis, mysteries of, ii. 37

Elk, regard for the, ii. 117, 118


Ellwangen, harvest ceremony in, ii. 17

Emin Pasha's reception in a Central African village, i. 155

Emu wren, ii. 336, 337

Encounter Bay tribe, their dread of women's blood, i. 186

English tradition concerning the killing of the wren, ii. 140, 141

Entlebuch, human scapegoat in, ii. 199

Entraigues, hunting the wren in, ii. 144

Epidemic, ceremony in time of, i. 36; ii. 84, 187-189

Epilepsy, supposed cure for, ii. 148, 149

Erfurt, harvest custom in, i. 336

Ertingen, midsummer custom in, i. 89

Erzgebirge, Shrovetide custom in the, i. 244

Eskimos, charm for lulling the wind, i. 28;


Eskimos and the soul, i. 122;
reception of strangers, i. 155;
Eskimo women, i. 170

[pg 392]

Essex, hunting the wren in, ii. 143

Esthonian superstition regarding the welfare of cattle, i. 72 sq.;


blood not tasted by the Esthonians, i. 178, 179;
belief concerning women's blood, i. 187;
preservation of the parings of nails by the Esthonians, i. 204;
carrying out the effigy of Death, i. 270;
ceremony at the eating of the new corn, ii. 69, 70;
dread of the weevil by the Esthonian peasants, ii. 129, 130

Ethiopian kings and their courtiers, i. 222

Etruscan wizards, i. 22

European rain-charm, i. 18;


forests, i. 57;
fire festivals, ii. 246-285

Evils, expulsion of, ii. 145 sq.;


occasional, ii. 158-162;
periodic, ii. 162-182;
two kinds of expulsion of evils, the direct or immediate, and the
indirect or mediate, ii. 158;
general observations on, ii. 202-206;
transference of, ii. 145 sq.

Fauns, representation of the, ii. 35;


the Fauns wood and corn-spirits, ii. 35, 36

Feilenhof, the wolf a corn-spirit in, ii. 3

Feloupes of Senegambia, charm for rain-making, i. 18

Fern seed, midsummer, ii. 365, 366

Fernando Po, restrictions on the food of the king of, i. 208

Fever, cure for, ii. 152, 153

Fida, no one to drink out of the king's glass in, i. 166

Field of Mars, chariot race on the, ii. 64-66

Fiji, charm used for staying the sun in, i. 24;


gods of, i. 39;
soul extraction in, i. 138;
belief in two souls in, i. 145;
eating in the presence of suspected persons avoided in, i. 160;
self-immolation at old age in, i. 216;
expulsion of devils in, ii. 175, 176;
initiatory rites in, ii. 344, 345;
offerings of first-fruits in, ii. 377, 378

Finland, wind selling in, i. 27;


cattle protected by the wood god in, i. 105, 106;
ceremony at the killing of a bear in, ii. 112

Fire festivals, human sacrifices offered at, i. 251

—— festivals in Europe, ii. 246-285;


they were charms to make the sun shine, ii. 267, 274

—— kings, i. 53-56

—— sacred, made by the friction of wood, ii. 269;


made with oak wood, ii. 292, 293

Fire spirit, expulsion of the, ii. 178

Firstborn sacrificed, i. 236, 237

First-fruits, festival of the, ii. 75-78;


offerings of, ii. 373-384

Fish, respect shown by savages to, ii. 118-122;


fish preachers, ii. 119, 120

Fladda's chapel and wind-making, i. 26, 27

Flamen Dialis, rules of life, i. 117;


not allowed to walk under a trellised vine, i. 183, 184;
cuttings from the hair and nails buried, i. 200;
restriction on the food of the, i. 207

—— Virbialis, i. 6

Flaminica, rules of life for the, i. 117, 118

Flanders, midsummer bonfires in, ii. 267;


Flemish cure for ague, ii. 153

Flax-pullers, custom of the, i. 375

Florence, “sawing the old woman” in, i. 261

Florida, sacrifice of the firstborn by the Indians of, i. 236, 237

Folk tales, resurrection in, ii. 125

Food, unconsumed, buried, i. 166;


prohibited food, i. 207, 208;
strong food, ii. 85

Forests, Europe covered with, in prehistoric times, i. 56

Fors, the, of Central Africa, preservation of nail parings by the, i.


204, 205

Forsaken sleeper, i. 96

Foulahs of Senegambia spare the crocodile, ii. 110

France, harvest customs in the northeast of, ii. 4

Franche Comté, harvest customs in, ii. 17

Frankish kings not allowed to cut their hair, i. 193

Friedingen, harvest custom in, ii. 27


Friesland, harvest customs in East, ii. 8

Frog-flayer, i. 92

Funeral custom, i. 129, 130

Fürstenwalde, harvest ceremonies in, ii. 7

Gablingen, harvest customs in, ii. 13

Galela, ceremony at the initiation of boys amongst the, ii. 353

Galicia, harvest customs in, ii. 8

Gall-bladder the special seat of courage amongst the Chinese, ii. 87

Gareloch, Dumbartonshire, harvest customs on some farms on the, i.


345

Garos, rain-charm used by the, i. 18

Georgia, rain-charm in, i. 17

Germany—German peasants and a whirlwind, i. 30;


sacred groves common amongst the ancient Germans, i. 58;
ceremony on felling a tree, i. 64;
rain-charm, i. 93;
custom [pg 393] after a death, i. 147;
superstition regarding the knife, i. 177;
superstition concerning hair cutting, i. 196, 199;
harvest custom, i. 337, 345, 374, 375; ii. 9;
harvest cries, i. 408, 409;
way to free a garden from caterpillars, ii. 130;
beating as a charm, ii. 216, 217;
oak the sacred tree, ii. 291;
oak log burnt on Midsummer Day, ii. 294;
the external soul in German stories, ii. 310-312
Gervasius, rain spring mentioned by, i. 19

Ghosts, the soul carried off by, i. 129-132;


annual expulsion of the ghosts of the dead, ii. 163

Giant, sham, procession and burning of the, ii. 280-282

Gilgit, ceremony on felling a tree in, i. 65;


sacred cedar of, i. 69 sq.;
harvest custom at, ii. 73, 74

Gilyak sacrifice of the bear, ii. 105-107

Girls secluded at puberty, ii. 225-247;


reason for, ii. 238-242;
not allowed to touch the ground or see the sun, ii. 225-253;
traces in folk tales of the rule which forbids girls at puberty to
see the sun, ii. 235-237

Goat, the, sacred, ii. 56, 63;


Dionysus as a, i. 326-328; ii. 34-37;
the corn-spirit as a, ii. 12-19

God, killing the, i. 213; ii. 218-222;


killing a god in animal form, i. 327, 328;
motives for killing the god, i. 214-216

God's Mouth, the name of the supreme ruler of the old Prussians, i.
223

Gods die and are buried, i. 213, 214

—— incarnate, slain, ii. 218-222

Gold Coast, sacrifices of the negroes of the, i. 67;


their superstition with regard to iron, i. 173

Golden Bough, Turner's picture of the, i. 1;


legend of the, i. 4;
the representative of the tree-spirit, i. 107;
between heaven and earth, ii. 223-243;
what was it, ii. 224;
the Golden Bough is the mistletoe, ii. 363, 368;
why was the mistletoe called the Golden Bough, ii. 365;
the Golden Bough an emanation of the sun's fire, ii. 367

Goldi sacrifice of the bear, ii. 107, 108

Gommern, harvest festival at, i. 370

Gonds, human sacrifices by the, i. 252, 384;


mock-human sacrifices, i. 252;
scapegoats amongst the, ii. 200

Good Friday custom, ii. 216

Gout transferred from a man to a tree, ii. 153

Grand Lama, death and reappearance of the, i. 42, 43;


and the shadow of Sankara, i. 142

Grandmother, a name given to the last sheaf, i. 336

Granny, a name given to the last sheaf, i. 336

Grass king, i. 91-93, 247

Grätz, midsummer custom in, ii. 267

Greece, rain-making in, i. 16;


tree worship in, i. 58, 59, 99;
festivals of the Greeks, i. 99, 100, 103;
ceremony at the laying of a foundation stone in, i. 144;
sacrificial ritual in, ii. 54, 55;
human scapegoats in, ii. 210-217;
midsummer fires in, ii. 266;
the external soul in Greek stories, ii. 305-307

Green George, i. 84-86

Grenoble, May Day in, i. 94;


harvest custom in, ii. 15, 47

Grihya-Sûtras, provision in the, for the burning of cut hair, i. 202

Grossvargula, Whitsuntide custom in, i. 91

Ground, sacred persons not allowed to touch the, ii. 224, 243 note;
girls at puberty not allowed to touch the, ii. 225-253;
sacred things may not touch the, ii. 243 note

Grüneberg, harvest ceremony in, ii. 11

Guanches, rain-charm in, i. 19

Guatemala, the nagual amongst the, ii. 333, 334

Guaycurus and storms, i. 28

Guinea, secreting of cut hair and nails in, i. 203;


annual expulsion of the devil by the negroes of, ii. 170;
time of licence in, ii. 204

Guyenne, harvest ceremony in, ii. 6

Hack-thorn, sacred, i. 69

Hadeln, reaping custom in the district of, i. 333

Haida Indian wind-charm, i. 26

Hair, burning of loose, i. 205;


burning after child-birth, i. 206;
cut hair deposited in a safe place, i. 200-205;
cutting, i. 193 sq.;
most sacred day of the year appointed for hair cutting, i. 197;
superstition concerning the cutting of the, i. 196, 198, 199;
cut only during a storm, i. 199;
haircutting as a disinfectant, i. 206, 207;
magic use of cut hair, i. 198, 199;
strength supposed to be in the, ii. 328;
hair not cut, i. 193-195;
superstition about cutting the hair and nails, i. 193-207

Halberstadt, human scapegoats in, ii. 199

Halibut, festival in honour of the, ii. 121

[pg 394]

Halmahera, rain-making in, i. 13, 21

Hampstead, forest of, i. 57

Hare, the corn-spirit as a, ii. 10 sq.

Harran, ritual observed by the heathen Syrians of, i. 283

Harvest child, a name given to the last sheaf, i. 344

—— cock, a name given to the last sheaf, ii. 7, 8

—— cries, i. 404-409

—— customs, i. 333-347, 352, 353, 367-381, 408; ii. 4-27, 32, 47,
48, 68-73, 213

—— festival, i. 169; ii. 171, 172, 374-376, 382-384

—— goat, ii. 13
—— maiden, a prototype of Proserpine, i. 356

—— May, i. 68, 69, 81, 82; ii. 4

—— omens, ii. 271

—— queen, i. 344

—— songs and cries, ii. 364-366, 404-409

Harz Mountains, Easter fires in the, ii. 253

Hawaii, detention of the soul in, i. 139;


capital offences in, i. 190

Hay family, the, and the mistletoe, ii. 362

Head, sanctity of the, i. 187-193;


ceremony at the washing of the, i. 188

Headache, transference of, ii. 149

Headington, May-day custom at, i. 94, 95

Heaven, the Golden Bough between heaven and earth, ii. 223-243

Hebrides, representation of spring in the, i. 97

Heligoland, disappearance of the herring from, ii. 120

Herbrechtingen, threshing custom in, ii. 22

Hercynian forest, i. 56, 57

Hereford, sin eaters in, ii. 154, 155

Herefordshire, midsummer fires in, ii. 262

Hermsdorf, harvest custom in, i. 338


Herodotus, story by, of the wind fighters of Psylli, i. 29

Herring, disappearance of the, from Heligoland, ii. 120

Hertfordshire harvest custom, ii. 24

Hessen, Ash Wednesday custom in, ii. 29;


sowing-time customs in, ii. 48

Hidatsa Indians, belief in the plurality of souls amongst the, ii. 339

Hierapolis, pigs sacred at, ii. 50

Himalayas, scapegoats in the Western, ii. 194

Hindoo cure for the murrain, ii. 191;


festival of Ingathering, ii. 272;
girls and puberty, ii. 234, 235;
the external soul in Hindoo stories, ii. 298-302

Hindoos, the, test of a suitable sacrificial victim, i. 36;


Hindoos and yawning, i. 123;
custom of nail cutting by the, i. 196;
festival at the eating of the new rice by the, ii. 73

Hindoo Koosh, smoke from the sacred tree inhaled by the sybil, i.
35;
blood sucking the test of a diviner amongst the, ib.;
expulsion of devils amongst the, ii. 173

Hippolytus, i. 6

Holland, Whitsuntide custom in, i. 88;


Easter fires, ii. 253

Holstein, reaping custom in, i. 333;


healing effects of the mistletoe in, ii. 289
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about testbank and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebooksecure.com

You might also like