Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
React 16 Essentials
React 16 Essentials

React 16 Essentials: A fast-paced, hands-on guide to designing and building scalable and maintainable web apps with React 16 , Second Edition

Arrow left icon
Profile Icon Pitt Profile Icon Artemij Fedosejev Profile Icon Adam Boduch
Arrow right icon
£7.99 £19.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
eBook Nov 2017 240 pages 2nd Edition
eBook
£7.99 £19.99
Paperback
£24.99
Subscription
Free Trial
Renews at £16.99p/m
Arrow left icon
Profile Icon Pitt Profile Icon Artemij Fedosejev Profile Icon Adam Boduch
Arrow right icon
£7.99 £19.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (2 Ratings)
eBook Nov 2017 240 pages 2nd Edition
eBook
£7.99 £19.99
Paperback
£24.99
Subscription
Free Trial
Renews at £16.99p/m
eBook
£7.99 £19.99
Paperback
£24.99
Subscription
Free Trial
Renews at £16.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

React 16 Essentials

Chapter 2. Installing Powerful Tools for Your Project

Here is a great quote by Charles F. Kettering:

"My interest is in the future because I am going to spend the rest of my life there."

This brilliant inventor has left software engineers with the single most important piece of advice way before we even started thinking how to write software. Yet, half a century later, we're still figuring out why we end up with spaghetti code or the "spaghetti mental model."

Have you ever been in a situation where you inherit code from a previous developer and spend weeks trying to understand how everything works because no blueprints were made available, and the pseudo-self-explanatory-code became too hard to debug? Better yet, the project keeps growing and so does its complexity. Making or breaking changes is dangerous and no one wants to touch that "ugly" legacy code. Rewriting the whole codebase is way too expensive, so the current one is supported by introducing...

Approaching our project

I firmly believe that the best motivation for learning new technology is a project that excites you that you can't wait to build. As an experienced developer, you've probably already built a number of successful commercial projects that share certain product features, design patterns, and even target audiences. In this book, I want you to build a project that feels like a breath of fresh air. A project, which you most likely wouldn't build in your day-to-day work. It has to be a fun endeavor, which will not only educate you but also satisfy your curiosity and stretch your imagination. However, assuming that you're a busy professional, this project shouldn't be a time-consuming, long-term commitment for you either.

Enter Snapterest—a web application that allows you to discover and collect public photos posted on Twitter. Think of it as a Pinterest (www.pinterest.com) with the only source of pictures being Twitter. We will implement...

Installing Node.js and npm

Node.js is a platform that allows us to write server-side applications with a client-side language that we're all familiar with—JavaScript. However, the real benefit of Node.js is that it uses an event-driven, nonblocking I/O model, which is perfect for building data-intensive, real-time applications. It means that with Node.js, we should be able to handle an incoming stream of tweets and process them as soon as they arrive; just what we need for our project.

Let's install Node.js. We'll be using version 8.7.0 because at the time of writing this book, that's the latest version of Node.js. Jest is a testing framework from Facebook that you'll learn about in Chapter 9, Testing Your React Application with Jest.

Download the installation package for your OS from one of these links:

Installing Git

In this book, we'll be using Git to install Node.js modules. If you haven't installed Git yet, visit https://git-scm.com/book/en/v2/Getting-Started-Installing-Git and follow the installation instructions for your OS.

Getting data from the Twitter Streaming API

The data for our React application will come from Twitter. Twitter has a Streaming API that anyone can plug into and start receiving an endless flow of public tweets in the JSON format.

To start using the Twitter Streaming API, you'll need to perform the following steps:

  1. Create a Twitter account. For this, go to https://twitter.com and sign up; or sign in if you already have an account.
  2. Create a new Twitter app by navigating to https://apps.twitter.com, and click on Create New App. You will need to fill the Application Details form, agree with Developer Agreement, and click on Create your Twitter application. Now you should see your application's page. Switch to the Keys and Access Tokens tab.

In the Application Settings section of this page, you'll find two vital pieces of information:

  • Consumer Key (API Key), for example, jqRDrAlKQCbCbu2o4iclpnvem
  • Consumer Secret (API Secret), for example, wJcdogJih7uLpjzcs2JtAvdSyCVlqHIRUWI70aHOAf7E3wWIgD...

Filtering data with Snapkite Engine

The amount of tweets that you'll receive via the Twitter Streaming API is more than you can ever consume, so we need to find a way to filter that stream of data into a meaningful set of tweets that we can display and interact with. I recommend that you take a quick look at the Twitter Streaming API documentation at https://dev.twitter.com/streaming/overview, and in particular, take a look at this page that describes the way you can filter an incoming stream at https://dev.twitter.com/streaming/reference/post/statuses/filter. You'll notice that Twitter provides very few filters that we can apply, so we need to find a way to filter that stream of data even further.

Luckily, there is a Node.js application just for this. It's called Snapkite Engine. It connects to the Twitter Streaming API, filters it using the available filters and according to the rules that you define, and outputs the filtered tweets to a web socket connection. Our proposed...

Approaching our project


I firmly believe that the best motivation for learning new technology is a project that excites you that you can't wait to build. As an experienced developer, you've probably already built a number of successful commercial projects that share certain product features, design patterns, and even target audiences. In this book, I want you to build a project that feels like a breath of fresh air. A project, which you most likely wouldn't build in your day-to-day work. It has to be a fun endeavor, which will not only educate you but also satisfy your curiosity and stretch your imagination. However, assuming that you're a busy professional, this project shouldn't be a time-consuming, long-term commitment for you either.

Enter Snapterest—a web application that allows you to discover and collect public photos posted on Twitter. Think of it as a Pinterest (www.pinterest.com) with the only source of pictures being Twitter. We will implement a fully functional website with the...

Installing Node.js and npm


Node.js is a platform that allows us to write server-side applications with a client-side language that we're all familiar with—JavaScript. However, the real benefit of Node.js is that it uses an event-driven, nonblocking I/O model, which is perfect for building data-intensive, real-time applications. It means that with Node.js, we should be able to handle an incoming stream of tweets and process them as soon as they arrive; just what we need for our project.

Let's install Node.js. We'll be using version 8.7.0 because at the time of writing this book, that's the latest version of Node.js. Jest is a testing framework from Facebook that you'll learn about in Chapter 9, Testing Your React Application with Jest.

Download the installation package for your OS from one of these links:

Run...

Installing Git


In this book, we'll be using Git to install Node.js modules. If you haven't installed Git yet, visit https://git-scm.com/book/en/v2/Getting-Started-Installing-Git and follow the installation instructions for your OS.

Getting data from the Twitter Streaming API


The data for our React application will come from Twitter. Twitter has a Streaming API that anyone can plug into and start receiving an endless flow of public tweets in the JSON format.

To start using the Twitter Streaming API, you'll need to perform the following steps:

  1. Create a Twitter account. For this, go to https://twitter.com and sign up; or sign in if you already have an account.

  2. Create a new Twitter app by navigating to https://apps.twitter.com, and click on Create New App. You will need to fill the Application Details form, agree with Developer Agreement, and click on Create your Twitter application. Now you should see your application's page. Switch to the Keys and Access Tokens tab.

In the Application Settings section of this page, you'll find two vital pieces of information:

  • Consumer Key (API Key), for example, jqRDrAlKQCbCbu2o4iclpnvem

  • Consumer Secret (API Secret), for example, wJcdogJih7uLpjzcs2JtAvdSyCVlqHIRUWI70aHOAf7E3wWIgD

Take a...

Filtering data with Snapkite Engine


The amount of tweets that you'll receive via the Twitter Streaming API is more than you can ever consume, so we need to find a way to filter that stream of data into a meaningful set of tweets that we can display and interact with. I recommend that you take a quick look at the Twitter Streaming API documentation at https://dev.twitter.com/streaming/overview, and in particular, take a look at this page that describes the way you can filter an incoming stream at https://dev.twitter.com/streaming/reference/post/statuses/filter. You'll notice that Twitter provides very few filters that we can apply, so we need to find a way to filter that stream of data even further.

Luckily, there is a Node.js application just for this. It's called Snapkite Engine. It connects to the Twitter Streaming API, filters it using the available filters and according to the rules that you define, and outputs the filtered tweets to a web socket connection. Our proposed React application...

Creating the project structure


Now it's time to create our project structure. Organizing source files may sound like a simple task, but a well-thought-out project structure organization helps us understand the underlying architecture of our application. You'll see an example of this later in this book, when we'll talk about the Flux application architecture. Let's start by creating our root project directory named snapterest inside your home directory ~/snapterest/.

Then, inside it, we will create two other directories:

  • ~/snapterest/source/: Here, we'll store our source JavaScript files

  • ~/snapterest/build/: Here, we'll put compiled JavaScript files and an HTML file

Now, inside ~/snapterest/source/, create the components/ folder so that your project structure would look like this:

  • ~/snapterest/source/components/

  • ~/snapterest/build/

Now when we have our fundamental project structure ready, let's start populating it with our application files. First, we need to create our main application file...

Left arrow icon Right arrow icon

Key benefits

  • Hands-on examples and tutorials for the latest React 16 release
  • Assess the impact of React Fiber for your future web development
  • Build maintainable and high performance React 16 web applications

Description

React 16 Essentials, Second Edition, fully updated for React 16, takes you on a fast-paced journey through building your own maintainable React 16 applications. React experts Artemij Fedosejev and Adam Boduch give you all the essentials you need to know and start working with React 16, in this new edition of the best-selling React.js Essentials title. You'll find the latest React 16 code updates, assessment of React Fiber, new coverage of Redux, and how to work as a modern React developer. The authors offer you their current assessment of React Fiber, and you'll soon be exploring React 16 hands on, creating your own single and multiple user interface elements with React 16. You'll then see how to create stateless and stateful components and make them reactive. You'll also learn to interact between your components and lifecycle methods, and gauge how to effectively integrate your user interface components with other JavaScript libraries. Delve deep into the core elements of the Redux architecture and learn how to manage your application and data persistence. Then go the extra mile with the Jest test framework, and run multiple tests on your applications and find solutions to scale without complexity. Today React is used by Facebook, Instagram, Khan Academy, and Imperial College London, to name a few. Many new users recognize the benefits of React and adopt it in their own projects, forming a fast-growing community. The speed at which React has evolved promises a bright future for anyone who invests in learning it today. Let Artemij and Adam bring you a brand new look at React 16 and React Fiber, and move your web development into the future.

Who is this book for?

If you're a frontend developer with some knowledge of native JavaScript development and frontend frameworks, wishing to learn the fastest web user interface library there is, then this book is ideal for you.

What you will learn

  • Learn to code React 16 with hands-on examples and clear tutorials
  • Install powerful React 16 tools to make development much more efficient
  • Understand the impact of React Fiber today and the future of your web development
  • Utilize the Redux application architecture with your React components
  • Create React 16 elements with properties and children
  • Get started with stateless and stateful React components
  • Use JSX to speed up your React 16 development process
  • Add reactivity to your React 16 components with lifecycle methods
  • Test your React 16 components with the Jest test framework

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 30, 2017
Length: 240 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787126343
Vendor :
Facebook
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 30, 2017
Length: 240 pages
Edition : 2nd
Language : English
ISBN-13 : 9781787126343
Vendor :
Facebook
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
£16.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
£169.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts
£234.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just £5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total £ 98.97
React Design Patterns and Best Practices
£36.99
Progressive Web Apps with React
£36.99
React 16 Essentials
£24.99
Total £ 98.97 Stars icon
Banner background image

Table of Contents

13 Chapters
1. What's New in React 16 Chevron down icon Chevron up icon
2. Installing Powerful Tools for Your Project Chevron down icon Chevron up icon
3. Creating Your First React Element Chevron down icon Chevron up icon
4. Creating Your First React Component Chevron down icon Chevron up icon
5. Making Your React Components Reactive Chevron down icon Chevron up icon
6. Using Your React Components with Another Library Chevron down icon Chevron up icon
7. Updating Your React Components Chevron down icon Chevron up icon
8. Building Complex React Components Chevron down icon Chevron up icon
9. Testing Your React Application with Jest Chevron down icon Chevron up icon
10. Supercharging Your React Architecture with Flux Chevron down icon Chevron up icon
11. Preparing Your React Application for Painless Maintenance with Flux Chevron down icon Chevron up icon
12. Refining Your Flux Apps with Redux Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(2 Ratings)
5 star 0%
4 star 50%
3 star 0%
2 star 50%
1 star 0%
Marco Jan 05, 2018
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
It's a very good book. I already read the previous edition where there are some concepts no more used neither in the official React documentation (but for me still usefull). The book is well organized and it brings you to understand the essential parts of React. I read several books about React but this one is one of the one clearest.Just one "technical question" that I would like to make to the author: why he doesn't present stateless components as functions?Anyway, a good book. I suggested it.
Amazon Verified review Amazon
Ahsan J. Sharafuddin Jun 21, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
The book is hard to follow. The code is not clearly stated and I couldn't get it to work for me. Had to give up half way through the book. I think the author unnecessarily complicates the topics. There are plenty of good books available on the market on the subject. I am immensely enjoying 'React Quickly'.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.