Beginning React and Firebase: Create Four Beginner-Friendly Projects Using React and Firebase Nabendu Biswas download
Beginning React and Firebase: Create Four Beginner-Friendly Projects Using React and Firebase Nabendu Biswas download
https://ebookmeta.com/product/beginning-react-and-firebase-
create-four-beginner-friendly-projects-using-react-and-firebase-
nabendu-biswas/
https://ebookmeta.com/product/mern-projects-for-beginners-create-
five-social-web-apps-using-mongodb-express-js-react-and-node-1st-
edition-nabendu-biswas/
https://ebookmeta.com/product/react-and-react-native-4th-edition-
adam-boduch/
https://ebookmeta.com/product/react-and-react-native-fifth-
edition-mikhail-sakhniuk/
https://ebookmeta.com/product/a-panorama-of-linguistic-landscape-
studies-first-edition-durk-gorter/
Reshaping the Business World Post-COVID-19: Management
Strategies for Sustainable Behavior Change 1st Edition
Arvind K. Birdie
https://ebookmeta.com/product/reshaping-the-business-world-post-
covid-19-management-strategies-for-sustainable-behavior-
change-1st-edition-arvind-k-birdie/
https://ebookmeta.com/product/a-vow-of-lust-and-fury-a-dark-
mafia-romance-lp-lovell/
https://ebookmeta.com/product/assignment-pentagon-how-to-excel-
in-a-bureaucracy-5th-edition-maj-gen-perry-m-smith-daniel-m-
gerstein/
https://ebookmeta.com/product/american-stories-a-history-of-the-
united-states-volume-2-since-1865-4th-edition-h-w-brands/
https://ebookmeta.com/product/the-poetics-of-angling-in-early-
modern-england-1st-edition-myra-e-wright-2/
The Bryce Walton Boys Adventure 1st Edition Bryce
Walton
https://ebookmeta.com/product/the-bryce-walton-boys-
adventure-1st-edition-bryce-walton/
Beginning
React and
Firebase
Create Four Beginner-Friendly Projects
Using React and Firebase
—
Nabendu Biswas
Beginning React
and Firebase
Create Four Beginner-Friendly
Projects Using React and Firebase
Nabendu Biswas
Beginning React and Firebase: Create Four Beginner-Friendly Projects Using React
and Firebase
Nabendu Biswas
Bhopal, India
iii
Table of Contents
iv
Table of Contents
Index��������������������������������������������������������������������������������������������������������������������� 181
v
About the Author
Nabendu Biswas is a full-stack JavaScript developer who has been working in the IT
industry for the past 16 years and has worked for some of the world’s top development
firms and investment banks. He is a popular tech blogger who publishes on dev.to,
medium.com, and thewebdev.tech. He is an all-round nerd, passionate about everything
JavaScript, React, and Gatsby. You can find him on Twitter @nabendu82.
vii
About the Technical Reviewer
Alexander Nnakwue is a self-taught software engineer with experience in back-end
and full-stack engineering. Nnakwue loves to solve problems at scale. He is currently
interested in startups, open source web development, and distributed systems. In his
spare time, he loves watching soccer and listening to all genres of music.
ix
CHAPTER 1
I ntroduction to Firebase
Firebase is not just a database but a set of tools; it is often called a back-end-as-a-service
(BaaS). Firebase contains a variety of services, as listed here:
Firebase makes it easy for front-end developers to integrate a back end into their
application, without creating any API routes and other back-end code. Figure 1-1 shows
an example of a traditional web app, which does API requests to the server from the
1
© Nabendu Biswas 2022
N. Biswas, Beginning React and Firebase, https://doi.org/10.1007/978-1-4842-7812-3_1
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
client apps. The rest of the code is handled by the server. As you can see in Figure 1-1,
Firebase eliminates the back-end work, and you communicate directly with Firebase,
hosted on the Google platform with an SDK.
It’s extremely easy to build a project in the Firebase back end with ReactJS as the
front end. If you made the same project in MERN (meaning MongoDB, Express, ReactJS,
NodeJS), it would take more time and would be far more complicated as you would need
to make the back-end APIs in NodeJS.
The other thing I find easy to do in Firebase is the authentication part.
Authentication used to be one of the most complicated parts of JWT authentication,
but with Firebase you need only a few lines of code. Even better, you get all types of
authentication.
Firebase hosting is also extremely easy to use for your ReactJS apps, and that is what
we are going to look at in this book.
2
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
S
etting Up Hosting
Click the Add project link on the page, as shown in Figure 1-3. Since I have a lot of
projects, the figure shows them on this page. For your first time, you will see only the Add
project link.
3
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
On the page that opens, give the project a name like final-space-react and click the
Continue button, as shown in Figure 1-4.
4
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
On the next page, click the Create project button after disabling Google Analytics, as
shown in Figure 1-5. We are disabling Google Analytics as we’re creating a demo project
here. If you intend to deploy your app in production, you should keep it enabled.
5
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
After some time, you will see the screen shown in Figure 1-6. Here, you need to click
the Continue button.
6
Chapter 1 Setting Up and Deploying a ReactJS Project with Firebase
Now, click the Settings icon at the top-left corner of the screen, as shown in
Figure 1-7. After that, click Project settings.
7
Other documents randomly have
different content
thing he had just completed. His thought began by searching ahead,
but swiftly it was caught and flung back into the deep channels of
memory such as never fail to claim when the heart of man is deeply
stirred.
A wide panorama of the past swept into his view. It began, as
everything seemed to begin with him now, at that time when he and
his young wife had taken their final decision to move northwards
where their spiritual desires could find expression in the wilderness
of untamed Nature. He remembered, how keenly he remembered,
the surge of thrilling anticipation with which they had embarked on
their mission. The bitter hardships they had had to endure, and the
merciless labours that had been theirs to make even their simple
lives possible here on the Hekor River, which followed so nearly the
course of the Arctic Circle. He remembered the selfless kindness of
Jim McLeod and his gentle wife. How they had helped him with
everything that lay in their power. Yes, it was a happy memory which
eased the strain of the thing besetting him now.
Then had come that first great happiness and finally disaster. Jim
was looking forward now to just the same moment in his life. That
first-born child. It was an ineffaceable landmark in the life of any
man.
He sighed. He was contemplating again the tragedy which had
followed hard in the wake of his overwhelming happiness. Poor little
Jean. Poor, poor little woman.
Her happiness was short enough lived, and his— In his simple,
earnest fashion he prayed God that Jim and Hesther should never
know a similar disaster. He wondered if little Jean knew of the thing
he was doing now. And if she would have approved had she been
there to witness it. Yes. Somehow he felt that her full approval
would have been his. It was for Felice. He desired nothing for
himself but to be permitted to carry on the labours of his Mission.
But for Felice—
He stirred uneasily. The scene of his devastated Mission lit again
before his mental gaze and tortured him. And suddenly he sat up
and carefully folded the annotated map he had prepared. He finally
enclosed it in a piece of American cloth, tied it up securely, and
sealed it with the fragment of wax he had discovered for that
purpose. Then he stood up and gazed about him. His dark eyes took
in every happy detail of the home which had served him so long.
And presently the man of peace found himself contemplating the
cartridge belt, with its two great revolvers protruding from their
holsters, which was hanging from its nail on the log wall.
For some moments he regarded it without any change of
expression. Then of a sudden he stirred and moved quickly over to
it. He removed first one gun from its holster, then the other. He
examined them. They were old-fashioned, and their chambers were
empty. Very deliberately, almost reluctantly, he loaded them in each
chamber. Then with another sigh he returned them to the holsters
where they belonged.
He turned away quickly. It was as though he detested the thing he
had just done and was anxious to rid himself of the memory of it. So
he passed into the room which he had always shared with his wife,
but which now was given up to the atom of humanity which was the
priceless treasure of his life.
The man was sitting on the stool set beside the simple bedcot. It
was the stool which Pri-loo was wont to occupy when watching over
the slumbers of the child she had taken to her mother heart. He was
gazing down upon the sleeping babe as she lay there under the
coloured blankets and patch-work quilt which was the daintiest
covering with which he had been able to provide her.
Fair-haired and sweetly cherubic the child lay breathing in that
calm, almost imperceptible fashion so sure an indication of perfect
health. Her colouring was exquisite. A subtle tracery of blue veins
was plainly visible beneath the delicate, fair skin. She was sweetly
pretty, and her brief four years of life had afforded her a generous
development sufficient to satisfy the most exacting parent.
The man’s dark eyes were infinitely tender as he regarded the
sleeping child. Gold? There was no treasure in the world comparable
with that, which, with her dying effort, his well-loved wife had
presented him. Felice—little Felice. The smiling, prattling creature,
the thought of whose wide blue eyes was unfailing in lightening
even the darkest shadows which the cares of her father’s life
imposed upon him.
He feasted himself now on the beauty which was so like to that of
the mother who had given up her life for his desire. And as he gazed
a surge of deep, tender feeling recalled a hundred happy memories.
And so for awhile he was filled with smiling thought.
But it passed. It passed with a suddenness that left a cold dew of
fear upon his brow for all the warmth of the Arctic summer night.
For even as memory had transported him to the days wherein his life
had known no shadow, so it had brought him again to the
recollection of the scene of mutilation he had witnessed at his
Mission. There he had seen children, younger even than Felice, lying
upon the ground limbless, headless, almost unrecognisable trunks.
An unconscious movement stirred him, and he shook his head as
though in denial of his thought. Then he gazed down upon the
sealed packet he was carrying in his hand. For long moments he
looked at it, and then, of a sudden, his eyes came back to the face
of the sleeping babe, and words came in a low, tender whisper.
“No, kiddie,” he murmured, “not while I have life. My poor Jean
gave you to me, little bit. And you’re just mine. All I am in the world
will defend you from harm such—such as—God! No. Not that. Psha!
No, it couldn’t be.” He wiped his forehead with a hand that was
unsteady. Then he forced a smile to his eyes just as he forced his
fears back and strove to think of the thing he had spent so many
hours preparing. He held up the packet in his hand before the child’s
closed eyes. “This wasn’t sent my way for nothing,” he whispered.
“It’s your luck, little kid. Yours. It’s for you, half of it. And—and if I
should fail—well, there’s others’ll see you get it. My little kiddie. My
little—”
He broke off. The man’s tender admonition died on his lips which
closed almost with a snap. His whole attitude underwent a change.
He sat rigid and listening, and his dark eyes were turned as though
seeking to peer over his shoulder.
It was a sound. A sound that came from beyond the outer room.
It was not from the direction of the kitchen place where Usak might
be returning home. No. It came from beyond the front door of the
shanty which was not the way Usak would come.
The missionary made no movement. Every sense was straining,
every faculty was alert. Sounds came in the night. It was a common
enough thing. But he had that in his mind now which gave to any
sound in the night the possibility of a new interpretation.
The moments passed. The tension eased. And again the fathers
eyes came back to the face of the sleeping child. But it was only for
an instant. Of a sudden he dropped the sealed packet into the child’s
cot and leapt to his feet.
Headlong he ran for the open doorway, and the purpose in his
mind was obvious. He passed it, and ran for the loaded guns
hanging upon the wall of his room. But he failed to reach them. A
shot rang out and he stumbled. Putting forth a superhuman effort he
sought to recover himself. But his legs gave under him and he
crashed to the floor with the first tearful cry of his wakened child
ringing in his ears.
CHAPTER VI
THE EURALIANS
The yellow eyes of the leader were turned on the young man who
had just re-entered the room bearing in his arms the screaming
Felice.
“Too late,” he said coldly. “You’ve blundered, Sate. It was that
clumsy shot of yours. Maybe you’ll learn someday. Tcha!”
Sate dropped the screaming child roughly to the ground. His black
eyes sparkled. There was triumph as well as resentment in them.
“That so? Oh, yes. Well, here are the plans. He sealed them when
they were finished. We saw that. Eh?”
He held out the packet he had found in Felice’s cot, and the older
man accepted it without a sign. In a moment he withdrew a sheath
knife and severed the fastenings. Flinging off the outer cover he
unfolded the contents. A glance was sufficient and he looked up
without a smile.
“Set fire to the place,” he ordered coldly.
Then he glanced down at the dead man. Felice had crawled up
close to the body of her father. Her baby arms were thrust about his
neck as though clinging to him for protection. Or maybe it was only
in that fond baby fashion she had long since learned. Her cries had
wholly ceased. Even in death the comfort of her father’s presence
and proximity were all sufficient to banish her every terror.
“Take her out,” he ordered, without a shadow of softening. “Set
her somewhere near by in the bluff. Maybe the folk across the river
will come along and find her when they see the fire. If they don’t,
well, maybe the—wolves will.”
The kyak was hauled out of the water. It lay there on a shelving
foreshore strewn with grey, broken granite, a graceful thing, so small
and light as to look utterly inadequate in face of the terrific race of
troubled waters that was speeding by. It was set ready for the
portage. The man’s simple outfit was securely lashed amidships, and
his precious rifle, long old-fashioned, but well cared for, was made
fast to the struts that held the frail craft to its shape.
The Indian was standing at the water’s edge. He was gazing up-
river where its course was a dead straight canyon several miles in
length. It was wide, tremendously wide. But so high were its sides
that its breadth became dwarfed. It was a gloomy, threatening
passage of black, broken water, whose rushing torrent no canoe
could face.
But the awe of the scene left Usak untouched. It was not the
sheer cliffs that concerned him. It was not the swirling race of water
blackened by the shadows. It was neither the might of the great
river, nor the vastness of the hill country about it that pre-occupied
him. It was the far-off white wall of mist and spray at the head of
the passage, and the dull distant thunder of the Falls, the Grand
Falls, the picture of whose might had lain hidden from the eyes of
man throughout the centuries.
He stood for long contemplating the mysterious far-off. His object
was uncertain. Perhaps the wonder of it had power to stir him.
Perhaps he was not insensible to the might of the things about him
for all the absorbing passion that filled him. Perhaps he was
contemplating with a sense of triumph this last barrier which still
remained to be surmounted.
At last he turned away. He came back to the burden which he
knew he had to shoulder. He measured the little vessel, and the
stowage of his outfit, with a keen eye for the necessity of his work.
And that which had been done left him completely satisfied.
He bent down. He gripped the gunwale of the little craft and tilted
it. Then with a swift, twisting movement he lifted, and, rearing his
great body erect again, the vessel was safely set where his muscular
neck checked it to a perfect balance.