Learning React: Modern Patterns for Developing React Apps, 2nd Edition (eBook PDF) pdf download
Learning React: Modern Patterns for Developing React Apps, 2nd Edition (eBook PDF) pdf download
https://ebookluna.com/product/learning-react-modern-patterns-for-
developing-react-apps-2nd-edition-ebook-pdf/
Learning React: Modern Patterns for Developing React Apps, 2nd Edition
(eBook PDF)
https://ebookluna.com/product/learning-react-modern-patterns-for-
developing-react-apps-2nd-edition-ebook-pdf/
https://ebookluna.com/product/ebook-pdf-instructional-patterns-strategies-
for-maximizing-student-learning/
(eBook PDF) Reflections: Patterns for Reading and Writing 2nd Edition
https://ebookluna.com/product/ebook-pdf-reflections-patterns-for-reading-
and-writing-2nd-edition/
https://ebookluna.com/product/ebook-pdf-patterns-of-modern-chinese-history-
by-charles-a-desnoyers/
Modern Sample Preparation for Chromatography, 2nd Edition Serban Moldoveanu
- eBook PDF
https://ebookluna.com/download/modern-sample-preparation-for-
chromatography-2nd-edition-ebook-pdf/
(Original PDF) Learning for Teaching, Teaching for Learning with Student
Resour
https://ebookluna.com/product/original-pdf-learning-for-teaching-teaching-
for-learning-with-student-resour/
(eBook PDF) Developing Content Area Literacy: 40 Strategies for Middle and
Secondary Classrooms 2nd Edition
https://ebookluna.com/product/ebook-pdf-developing-content-area-
literacy-40-strategies-for-middle-and-secondary-classrooms-2nd-edition/
https://ebookluna.com/download/business-communication-developing-leaders-
for-a-networked-world-ebook-pdf/
https://ebookluna.com/product/ebook-pdf-patterns-of-world-history-combined-
volume-2nd-edition/
c. Typechecking for React Applications
i. PropTypes
ii. Flow
iii. TypeScript
d. Test-Driven Development
i. TDD and Learning
e. Incorporating Jest
Copyright © 2020 Alex Banks and Eve Porcello. All rights reserved.
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.
Along the way, check out the GitHub repository. All of the examples
are there and will allow you to practice hands-on.
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.
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.
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.
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].
How to Contact Us
Please address comments and questions concerning this book to the
publisher:
Sebastopol, CA 95472
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.
For news and information about our books and courses, visit
http://oreilly.com.
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.
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.
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.
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.
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.
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.
Discovering Diverse Content Through
Random Scribd Documents
from its becoming flooded, now suddenly became so dry that there was but
half a fathom of water on its bar; and over this it was impossible even for
the admiral’s small vessel to pass. He had no remedy, therefore, but to have
recourse to patience—that virtue of which he stood so much in need
throughout his memorable career—and to await the return of the rainy
season.
Meanwhile the Cacique Quibian, as was but natural, looked with
jealousy upon the proceedings of the strangers who were making
themselves so much at home within his territories. Under pretext of
preparing for war upon a neighbouring chief, he summoned his fighting
men to assemble on the river Veragua. But suspicion was aroused in the
mind of the admiral’s notary, who obtained permission to reconnoitre the
Indian camp. On his return, he gave it as his opinion that a large party of
natives whom he had observed on the march had been on their way to
surprise the Spanish settlement. Columbus, being unwilling to accept this
view without further confirmation, gave permission to Mendez to proceed
on a second scouting expedition, the result of which was such as to dispel
his doubts; whilst any lingering disbelief was banished by information
conveyed to him by a native who had acted as interpreter, and who revealed
to the admiral the designs of his countrymen, which he had overheard. It
had been the intention of Quibian to surprise the harbour at night; to burn
the ships and houses; and to effect a general massacre.
In view of the above disclosures, Columbus set a double watch upon the
harbour: but his brother, the Adelantado, resolved upon more vigorous
measures. At the head of seventy-four men, together with the interpreter, he
set off in boats for the Veragua, and landed below the house of Quibian,
before the latter had notice of his movements. Then taking with him only
five men, he ascended the hill, ordering the others to follow with great
caution. On a given signal they were to surround the dwelling. The cacique
was seized by Don Bartholomew, and, after a violent struggle, was bound
hand and foot. His household, consisting of about fifty persons, were
likewise made prisoners; and so well were the Adelantado’s measures taken
that no blood was shed on the occasion.
Committing his prize to the care of his pilot, with orders to take him on
board his boat, the Adelantado, with a portion of his men, set out in pursuit
of the Indians who had escaped. But the wily cacique was more than a
match for the honest pilot. On his complaining piteously of the pain caused
by his bonds, the soft-hearted Sanchez was induced to loosen the cord; upon
which Quibian, watching his opportunity, plunged into the water and
disappeared. On the following morning the Adelantado, being convinced of
the futility of pursuit, returned to the ships with the spoils of Quibian’s
mansion, which amounted to the insignificant value of three hundred
ducats.
All was now apparently tranquil; and the rainy season having once more
set in, Columbus took leave of his brother, and got under weigh with three
of the caravels, leaving the fourth for the use of the settlement. The ships,
having been towed over the bar, anchored within a league of the shore, to
await a favourable wind. It was the intention of the admiral to touch at
Hispaniola, and thence to send his brother supplies and reinforcements. As
the adverse wind detained him for some time, he sent a boat on shore to
procure wood and water. It was well for the colony that he did so. The
Cacique Quibian had not perished, as was supposed, but had found his way
ashore. When he saw the vessels bearing his family to afar, he was driven to
despair, and thought only of vengeance. Assembling his warriors, he
approached the settlement secretly, and fell upon the Spaniards when they
were completely off their guard. After a severe struggle, the Indians were
driven back, but not before they had killed one Spaniard and wounded eight
others. Notwithstanding this warning, the boat’s crew sent by Columbus
proceeded up the river, and, being surprised by the Indians, were cut off,
one man alone escaping.
This misfortune filled the colony with dismay, more especially as the
Indians forthwith renewed hostilities. As it was considered no longer safe to
remain in the fortress, owing to its vicinity to the wood, the Adelantado
erected a barricade in an open space by the sea. The Indians were deterred
by the firearms of the Spaniards from venturing forth from the forest; but
the latter looked forward with the utmost dread to the hour when the
ammunition should be exhausted, and when they should be driven forth in
search of food.
In the meanwhile Columbus was subjected to scarcely less anxiety. The
non-return of his boat foreboded disaster; and he did not venture to risk his
only remaining boat, on account of the heavy surf on the shore. An
occurrence had also taken place which added not a little to the gloom on
board of the squadron. It had been the intention of Columbus to carry
Quibian’s family to Spain, as hostages for the good behaviour of the Indians
during his absence. The captives, however, were determined to secure their
liberty, if possible. The hatchway above the forecastle where they slept had
not been fastened, as it was out of reach of the prisoners, and as some of the
crew slept upon it. This neglect being observed by the captives, despair lent
them ingenuity. Collecting together a quantity of the ballast, they raised a
heap beneath the hatchway. Several Indians mounting on the stones, by a
simultaneous effort, then raised it, violently dislodging the sleeping seamen.
The Indians instantly sprang forth, and many, plunging into the sea, swam
ashore. Some, however, were caught and forced back into their place of
imprisonment. In the morning it was found that all the prisoners had hanged
themselves.
In this state of perplexity, one brave man volunteered to bring
1503.
relief to the admiral’s mind. Pedro Ledesma of Seville offered, if
the boat should take him to the edge of the surf, to swim ashore through it, a
feat which he successfully accomplished. He returned to the ships, to tell
his commander that the Adelantado’s party were in all but open mutiny, and
that they were sworn, if the admiral should refuse to take them on board, to
depart in the caravel so soon as it might be practicable. Columbus, as may
be supposed, was in no slight alarm for his brother, placed as he was
between mutineers and savages. There appeared nothing to do but to take
the whole party on board, and to return to the settlement at some future day;
but the state of the weather was such as to render the execution of this plan
not a little difficult. After nine boisterous days, however, the sea again
became calm, and great exertion was made to get the people off ere the bad
weather should return. In this emergency, the services of Diego Mendez
were especially useful. Having lashed two Indian canoes together, he
erected on them a raft, upon which the stores left on shore and on the
caravel were towed out to the ships. In this manner, in the course of two
nights and days, everything of value was conveyed on board the squadron,
Mendez and five companions being the last to leave the shore.
The joy of the Spaniards was unbounded on finding themselves once
more afloat. The wind becoming favourable, Columbus, towards the end of
April 1503, set sail for the last time from the disastrous coast from which
his descendant takes his title.[E] Instead, however, of making direct for
Hispaniola, he, to the surprise of his pilot and crews, stood along the coast
to the eastward.
This study of the currents had taught him that, in order to avoid being
carried beyond his destined port, he must first gain considerable way to the
east. At Porto Bello he was obliged to leave one of his caravels, it being so
pierced by worms that it could no longer be kept afloat. Even his two
remaining vessels, into which were now crowded the crews of the four,
were in a very unseaworthy condition, and were only kept afloat by
incessant labour at the pumps. Continuing onwards, they passed Porto
Retrete and approached the entrance of the Gulf of Darien, when, yielding
to the remonstrance of his captains and pilots, the admiral bade final
farewell to the mainland; and on the 1st of May he stood northward in quest
of Hispaniola. At this point of his career we must take leave of the
discoverer of America. To pursue further the narrative of his last voyage
would take us beyond the limits within which this work must be confined,
that is to say, beyond the limits of South America.
Note.—The problem of rendering in English the names of places in foreign countries
is one of some difficulty, and rests rather on conventionality than on principle. It is solved
by different writers in different fashions. Greek purists have for some time past lost no
opportunity, in writing Greek words, of substituting the original Greek K for the Roman C;
but they still respect the latter in names of such places, familiarized to our ears by
Scripture, as Corinth and Crete. In like manner Oriental purists, such as Sir Frederic
Goldsmid and Colonel Malleson, have done their best to introduce into English literature a
system of orthography as to Oriental names which is, of course, in place in the schoolroom
of a professor of Oriental languages, but which has not yet made itself fully accepted by
the general English reader. Those of us whose acquaintance with Indian history began with
the reading of Macaulay’s Essays on Clive and Hastings, are loth to accept Pílasi for
Plassey and Lakhnao for the capital of the princely House of Oude.
To look nearer home, it would be pedantic to use El Kahira for Cairo, or Dimishk for
Damascus. It would be little less so, although strictly correct, to use Venezia for Venice,
Roma for Rome, or Livorno for Leghorn. We have added an s—why, I know not—to the
French spelling of the word Marseille. That port is as familiar in our mouths as Liverpool
or Glasgow, but we invariably write it and pronounce it Marseilles. In writing Spanish or
Portuguese words applied to names of places in South America, I find a considerable
divergence of custom amongst authors. To take the one name of Assumption, for instance.
The capital of Paraguay is so written by the Robertsons and other writers, whilst in
Southey’s History of Brazil it is throughout written Assumpcion. In Washburn’s History of
Paraguay it becomes Asuncion, the original Spanish name, which I see no reason to
supersede. As a rule I have followed the native names of places in Portuguese or Spanish
America, they being for the most part those by which they are known in England.
CHAPTER II.
1508-1514.
CHAPTER III.
1514-1517.
Once more at Darien, Vasco Nuñez lost no time in drawing up for the king
a report of his expedition across the mountains to the Southern Sea, in
which report he states that during the expedition he had not lost a single
man in battle. But, by a singular mischance, the vessel which bore his friend
and messenger, Arbolanche, who had himself taken part in the toils and
dangers which he was to describe, did not sail from Darien until the
beginning of March. This delay ruined the rising fortunes of Vasco Nuñez.
The Bachelor Enciso, as has been already said, had carried his
complaints against Nuñez to the foot of the throne; and when, in May 1513,
he was followed by Caÿzedo and Colmenares with their glowing account of
the province of Zenu, with its mountain streams that flowed over golden
sands, their news served but to hasten the appointment of a governor over
this favoured region. The royal choice fell, on the recommendation of
Fonseca the Bishop of Burgos, upon Don Pedro Arias Davila, commonly
called Pedrarias, who, on July 27th of the same year, was appointed ruler
over Darien. The new governor was an elderly gentleman of rank, who had
been brought up in the royal household and had afterwards distinguished
himself as a soldier; but he has been well called, as his subsequent actions
proved him to be, “a suspicious, fiery, arbitrary old man.”[F]
The envoys of Nuñez had asked King Ferdinand for a thousand men,
wherewith to enable their master to make the discovery of the Southern Sea.
Ferdinand fully appreciated the importance of the enterprise; and, although
he did not intend it for Nuñez, he assigned twelve hundred men to Pedrarias
for its accomplishment. It so happened that at this time the Great Captain,
the famous Gonsalvo de Córdova, was preparing to return to Naples; and
the chivalry of Spain were thronging to enlist under his banner. His
armament was, however, countermanded when on the point of sailing; and
thus a large number of young nobles and cavaliers, who had set their hearts
on winning their spurs, had their plans suddenly thwarted. Pedrarias had a
host of volunteers anxious to join his expedition to the country which had
already received the appellation of Castilla del Oro, or Golden Castile. In
order to enable him to comply with the wishes of these applicants, he was
permitted to increase his force to the number of fifteen hundred men; but in
the end some two thousand embarked. Pedrarias was likewise accompanied
by a bishop and four principal officers, one of whom was the Bachelor
Enciso, now appointed alguazil mayor. He was also accompanied by his
wife Doña Isabella de Bobadilla. He received instructions not to admit any
lawyers into his colony,—an instruction subsequently more than once
repeated in respect to Spanish-American colonies.
Scarcely had his fleet of fifteen vessels set sail from San
1514.
Lucar, on the 12th of April 1514, when Arbolanche arrived,
bearing the news of the glorious exploits of Nuñez. Had he come but a few
days earlier, how widely different would have been the future of that
cavalier! King Ferdinand gazed with delight on the pearls and gold which
the messenger of Nuñez laid before him, and his imagination was carried
away by the tale of the unknown seas and wonderful realms which were
about to be brought under his sway. The popularity of Nuñez suddenly
became unbounded, and the fame of his exploits resounded throughout
Spain. The ill impression which had been produced on the king’s mind by
the reports of Enciso was forthwith obliterated, and the Bishop of Burgos
was instructed to devise some means of rewarding his surpassing services.
But meanwhile the cavalier himself was afar off, and the waves of the
Atlantic were fast bearing to Darien the jealous old man who was to see in
Nuñez only one who had robbed him of the glory which he had proposed to
himself of being the first discoverer of the Southern Sea and the conqueror
of the regions of gold and pearls on its shores.
Meanwhile Vasco Nuñez was governing the region subjected to his rule
in such a manner as to prove that the popular selection which had elevated
him to the position of chief was justified by his qualities as a peaceful ruler
no less than by his exploits as a warlike adventurer. The settlement
contained upwards of two hundred houses or huts, and the constant effort of
the captain-general was to bring the neighbourhood into such a state of
cultivation as to render Darien independent of Europe for supplies. Its
population now amounted to about five hundred Europeans and fifteen
hundred Indians. The climate being depressing, Nuñez, who was a born
governor, took advantage of every means to keep his people in good spirits,
devoting the holidays as they came round to national sports and games,
including tilting matches. He was singularly successful in securing the
friendship, as well as in gaining the respect, of the natives; so that the
Spaniards could travel, even singly, all over the district in perfect safety. It
was certainly a circumstance full of misfortune, as well for Spain as for the
inhabitants of the Isthmus, that when, after the experience of so many
unfortunate colonising expeditions and so many incapable leaders, one was
at length found admirably suited alike for the requirements of peace and of
war, he should have had so soon to give place to a man whose age unfitted
him to fulfil the duties of leader, and whose temper prevented him from
recognising the merits of those who acted under him.
In June the fleet of Pedrarias arrived in the Gulf of Urabá.
1514.
The new governor, knowing the character and the renown of
Nuñez, was somewhat apprehensive lest he should decline to render up
peaceful possession of his government, and he accordingly thought it
prudent to cast anchor about a league and a half from the shore, and to send
a messenger in advance to announce his arrival. He need not, however, have
felt any misgiving; for Nuñez forthwith sent back his messenger with
congratulations on his safe arrival, and with the expression of his own
readiness and that of all the colony to obey his orders. It is true that some
fiery adherents of the popular leader expressed their desire to repel the
intruder; but these were at once discountenanced by their chief. The new
governor, disembarking on the last day of June, made his entrance into
Darien at the head of two thousand armed men, he leading his wife by the
one hand and having Bishop Quevedo on the other; whilst a train of
youthful cavaliers formed his body-guard. Vasco Nuñez came forth
unarmed to meet him, attended by a detachment of his scarred and veteran
troops. He conducted his guests to his humble straw-thatched abode, where
he laid before them such a repast as this embryo city of the forest might
afford, the only beverage procurable being water. We may well believe that
the courtly cavaliers who formed the governor’s train were somewhat taken
aback by the simple nature of their first entertainment in Golden Castile.
Pedrarias, on the day of his arrival, summoned Vasco Nuñez to his
presence and held with him a long private conference, at which the historian
Oviedo assisted. In accordance with the governor’s request, Vasco Nuñez
gave an account in writing, in the course of two days, of his administration
during the past three years. He likewise described the rivers and mountains
where he had found gold, the caciques who were his allies, and his journey
to the Southern Sea and to the Isle of Pearls. Having thus obtained the
information which he required, and which Nuñez alone could furnish,
Pedrarias next proceeded to take the residencia of the late captain-general,
that is to say, he instituted an inquiry into his past conduct, the result being
that for the injuries done to Enciso and others, Nuñez was condemned to
pay a large amount, although he was acquitted of the criminal charges
brought against him. The governor was now his declared enemy, and would
have sent him in chains to Spain, to be tried for the death of Nicuesa, had he
not been warned by the Bishop Quevedo, who was Nuñez’ friend, that his
arrival in Spain would be the signal of his triumph, and that the result would
in all probability be his return to Panamá with increased power and
position. Nuñez had likewise found an advocate in the wife of the governor,
who could not but admire his character and exploits. Under these
circumstances it was thought better to detain him at Darien under a cloud.
His property, which had been sequestrated, was, however, restored to him.
Nuñez, in his letter to the king, had advised the creation of settlements in
the territories of Comagre, Ponca, and Pocorosa, with a view to establishing
a line of posts across the mountains between Darien and the Southern Sea;
and it was now determined to carry out this plan. Whilst preparations were
being made with this view, the Spaniards who had accompanied Pedrarias
began to suffer greatly from the effects of the climate, and were likewise
sorely pressed by hunger. The colony had not been in any way prepared for
such an accession to its numbers; nor were there any neighbouring friendly
Indians on whom to fall back for a supply of provisions. Men brought up in
luxury, and who were clad in fine raiment, were glad to procure herbs and
roots, or were actually perishing from starvation. One of the principal
hidalgos dropped down dead in the street, starved. Within a month’s time
seven hundred men had perished, whilst Pedrarias himself was taken
seriously ill. The provisions which had been brought out were now
exhausted, and the horrors of famine stared the whole colony in the face. In
this gloomy state of affairs Pedrarias was glad to give permission to a ship-
load of starving adventurers to depart for Cuba and for Spain.
When the governor had recovered from his malady, he urged on the
expeditions which he had planned; but he was careful not to permit Vasco
Nuñez to acquire additional renown by taking part in them. That cavalier
was still allowed to remain under the cloud of a judicial inquiry hanging
over him. Notwithstanding the provision which had been made not to admit
lawyers into the colony, the legal profession was at this time so flourishing
at Darien that it was estimated that there were about forty lawsuits to each
colonist.
Vasco Nuñez, oppressed by this inaction, determined to prosecute his
plans on his own account, without reference to the governor; and he
despatched one Garabito to Cuba to enlist men for an expedition across the
mountains and to found a colony on the Southern Sea. Whilst Garabito was
absent, Nuñez was condemned to behold his schemes ruined, owing alone
to the incapacity and brutality of those entrusted by Pedrarias with the
mission of carrying them out. Amongst the leaders employed by the
governor was one Juan de Ayora, who was sent with four hundred men to
build forts in the countries ruled over by Comagre, Pocorosa, and
Tubanamá respectively. This officer proved himself an exceptional ruffian
even amongst the Spanish transatlantic adventurers of the day. According to
Oviedo, who was at this time notary of the colony, he not only demanded of
the chiefs and their subjects the authorised requisitions to avert war, but,
pouncing upon the caciques and principal men by night, he put them to the
torture in quest of gold. Some he then caused to be put to death; others were
given to be devoured by the dogs; whilst others again were reserved for new
forms of torment. Their wives and daughters were taken from them, and
were made slaves and concubines according to the good pleasure of this
Ayora.
One of the first victims of this expedition was Comagre himself, the
same youthful cacique who had given to Vasco Nuñez the earliest
information of the existence of the sea beyond the mountains, and who had
told him that a thousand men would be needed for its discovery. Little did
he imagine that he himself would be one of the victims of the thousand men
who had now been brought by his advice! The chiefs with whom Vasco
Nuñez had cemented a friendship came forth in turn to lay their gold before
Ayora. The valiant Tubanamá, being of a less submissive turn of mind, took
to arms, but to no avail. Another cacique, having put his women and
children in safety, laid wait in ambuscade and attacked the Spaniards,
wounding Ayora himself.
The proceedings of Ayora towards another cacique are thus described by
a lawyer sent on a mission of inquiry to the West Indies a few years later by
Cardinal Ximenes. On the approach of the Spaniards, the cacique in
question, under the belief that he was about to welcome his old friend
Nuñez, had prepared for him the best entertainment within his means,
including roast-meat, game, and wine. On his inquiring for the chief, Ayora
was pointed out to him, but he replied that this was not Nuñez. He was,
however, to become well acquainted with his present guest during their
brief intercourse. After having partaken of his hospitality, Ayora sent for
him and demanded gold. This not being forthcoming in sufficient quantity,
the cacique was bound, upon which his vassals were desired by him to
bring all the gold in their possession. The amount, however, did not satisfy
the invader, who ordered the cacique to be burnt alive.[G]
Not being troubled as to the means he took to obtain it, it was but natural
that this scoundrel should gather together a considerable quantity of gold; it
is some satisfaction to the moral sense to know that neither Ayora nor any
one else was any the better for it. The idea of delivering up his ill-gotten
treasures was repugnant to the avarice of this robber, who secretly made off
with them to sea and was never more heard of. The colony which he had
founded at Santa Cruz met with no better fate. The garrison, having given
much offence to the Indians, were beset at night by Pocorosa and his
people; a desperate struggle ensued, but when morning broke, only five
Spaniards were left alive to carry the tale to Darien. It may here be
mentioned that Hurtado, who had been sent by Pedrarias to discover the
causes in the delay of the return of Ayora, brought back with him to Darien
a hundred peaceful Indians, of whom he disposed as slaves. A number of
these had been lent to him as carriers by the cacique Careta, the friend and
ally of Nuñez.
In a letter addressed to Vasco Nuñez, King Ferdinand
1515.
expressed his high sense of his merits and services, and
constituted him Adelantado of the Southern Sea, and governor of the
provinces of Panamá and Coybá. He was, however, to be subordinate to
Pedrarias. A letter was likewise written at the same time to the latter,
informing him of this arrangement, and requiring him to consult with Vasco
Nuñez upon all affairs of importance. This communication was a severe
blow to the vanity of the jealous old man; and upon its receipt, he
summoned a council to deliberate as to what action should be taken. It was
finally arranged that the above-mentioned titles and dignities should be
nominally conferred upon Nuñez, but that for the meantime he was not to
enter into possession of the territories assigned to him.
At this critical moment Carabito, the agent of Nuñez, happened to return
from Cuba with a vessel freighted with arms and ammunition, and having
seventy men on board. He anchored at some distance from Darien, but sent
word of his arrival to Nuñez, all of which became speedily known to
Pedrarias. The suspicious mind of the latter taking the alarm, he at once
ordered Nuñez to be seized and confined; but he was prevailed upon by the
bishop to inquire into the matter calmly, the result being that, as nothing
treasonable was proved against him, Nuñez was set at liberty.
The bishop next endeavoured to persuade Pedrarias to employ Vasco
Nuñez on an expedition which he was about to despatch to the Southern Sea
and to the Isle of Pearls. As, however, there was much credit and probably
much wealth to be derived from it, Pedrarias preferred to give the command
to his own kinsman, Morales, with whom he associated Francisco Pizarro,
who had been in Nuñez’ expedition to the same region. Gaspar Morales
accordingly started with sixty men, and traversed the mountains by a
shorter route than that which had previously been taken. He arrived at the
territories of a cacique named Tutibrá, where he left one-half of his men
under Peñalosa, whilst with the remainder he set out in canoes for the Pearl
Islands. On arriving at the Isla Rica, so named by Nuñez, they experienced
a warm reception from the cacique, who sallied forth four times against
them, but who was as often repulsed with loss. His warriors were paralysed
by the firearms and the blood-hounds, and the cacique was at length obliged
to sue for peace. He presented to his guests as a peace-offering a basket
filled with pearls, two of them being of remarkable size and beauty. Taking
Morales and Pizarro to the summit of a wooden tower, he pointed proudly
to a long vista of islands subject to his sway, and promised his new friends
as many pearls as they might desire so long as they should continue to give
him their friendship.
Turning towards the mainland, which stretched away mountain upon
mountain as far as the eye could reach, the communicative chief told his
guests of a country of inexhaustible riches that lay in that direction. His
words and suggestions were not lost upon one of the two men who listened
to him. The cacique further agreed to become the vassal of the king of
Castile, and to pay him an annual tribute of one hundred pounds weight of
pearls. The party then returned to the mainland at another point than that at
which they had embarked, when Morales sent a detachment of ten men to
conduct Peñalosa and his party from the village of Tutibrá.
During the absence of the Spanish leaders at the islands, a conspiracy
had been formed by a large number of the caciques along the coast to
massacre the whole band of invaders. This measure was undoubtedly the
result of grossly tyrannical conduct on the part of the Spaniards. By some
writers the provocation is ascribed to Peñalosa; by others it is given to
Morales himself, who is stated on one occasion to have come upon an
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookluna.com