• Complain

Andrea Chiarelli [Andrea Chiarelli] - Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React

Here you can read online Andrea Chiarelli [Andrea Chiarelli] - Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2018, publisher: Packt Publishing, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Andrea Chiarelli [Andrea Chiarelli] Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React
  • Book:
    Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React
  • Author:
  • Publisher:
    Packt Publishing
  • Genre:
  • Year:
    2018
  • Rating:
    3 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 60
    • 1
    • 2
    • 3
    • 4
    • 5

Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Take your web applications to a whole new level with efficient, component-based UIs that deliver cutting-edge interactivity and performance.

Key Features
  • Elaborately explains basics before introducing advanced topics
  • Explains creating and managing the state of components across applications
  • Implement over 15 practical activities and exercises across 11 topics to reinforce your learning
Book Description

Projects like Angular and React are rapidly changing how development teams build and deploy web applications to production. In this book, youll learn the basics you need to get up and running with React and tackle real-world projects and challenges. It includes helpful guidance on how to consider key user requirements within the development process, and also shows you how to work with advanced concepts such as state management, data-binding, routing, and the popular component markup that is JSX. As you complete the included examples, youll find yourself well-equipped to move onto a real-world personal or professional frontend project.

What you will learn
  • Understand how React works within a wider application stack
  • Analyze how you can break down a standard interface into specific components
  • Successfully create your own increasingly complex React components with HTML or JSX
  • Correctly handle multiple user events and their impact on overall application state
  • Understand the component lifecycle to optimize the UX of your application
  • Configure routing to allow effortless, intuitive navigation through your components
Who this book is for

If you are a frontend developer who wants to create truly reactive user interfaces in JavaScript, then this is the book for you. For React, youll need a solid foundation in the essentials of the JavaScript language, including new OOP features that were introduced in ES2015. An understanding of HTML and CSS is assumed, and a basic knowledge of Node.js will be useful in the context of managing a development workflow, but is not essential.

Table of Contents
  1. Introducing React and UI Design
  2. Creating Components
  3. Managing User Interactivity

**

About the Author

Andrea Chiarelli has over 20 years of experience as a software engineer and technical writer. In his professional career, he has used various technologies for his projects: from C# to JavaScript, from Angular to React, and ASP.NET to PhoneGap/Cordova. He has contributed to many online and offline magazines and is the author of several books published by Wrox Press and Packt. Currently, he is a software architect at the Italian office of Apparound, Inc. and a regular contributor to HTML.it, an Italian online magazine focused on web technologies.

Andrea Chiarelli [Andrea Chiarelli]: author's other books


Who wrote Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React? Find out the surname, the name of the author of the book and a list of all author's works by series.

Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Using the Router

Once we have installed the React Router package in our environment, we need to use the provided components in our application.

The first thing we need to do is add routing capabilities to our application. We can do this by changing the code of the index.js file, as follows:

import React from 'react';
...
import { BrowserRouter } from 'react-router-dom'
ReactDOM.render(
, document.getElementById('root'));
registerServiceWorker();

We highlighted the main differences, with respect to the previous version of the code. As you can see, we imported the BrowserRouter component from the react-router-dom module and wrapped the App component inside of it.

By wrapping the App component, the BrowserRouter component enriches it with routing capabilities.


This is a component composition hence we have called this as component wrapping.
Installing create-react-app

Fortunately, we can use create-react-app, a command-line interface (CLI) tool that allows us to set up a React-based application without needing to configure any of the aforementioned tools. It is based on Node.js and provides commands to set up and modify a React application in an immediate way.

In order to install create-react-app, you need Node.js installed on your machine. You can install the CLI by typing the following command in a console window:

npm install -g create-react-app

After installation, you can verify whether it is properly installed by typing the following command:

create-react-app --version

If all is OK, the installed version of create-react-app will be shown.

Adding CSS

We will now change the content of the existing project, my-shop-01, in order to add some CSS code and show the catalog title in red:

  1. Open a console window.
  2. Move to the my-shop-1/src folder.
  3. Create a file, Catalog.css, and add the following code:
h2 { color: red }
  1. Open the Catalog.js file and add the statement to import the Catalog.css module, as shown here:
import React from 'react';
import './Catalog.css';
class Catalog extends React.Component {
render() {
return
Catalog
;
}
}
export default Catalog;
  1. Run npm start and look at the result.

You can find a project ready in the my-shop-02 folder at Code/Chapter-2 .

The browser will show the Catalog title in red:

The CSS import is not a React feature and it is not required by React It is a - photo 1
The CSS import is not a React feature, and it is not required by React. It is a convenience provided by the development environment, built by create-react-app. In particular, this feature is provided by webpack, one of the most frequently used bundlers and module loaders.
You should take this aspect into account when you want to migrate the application into a development environment not based on webpack.
Nested Views

In the preceding examples, we implemented view navigation in the App component by using the Switch, Route, and Link components provided by React Router. We can use these routing components inside of any other component so that we can build nested views and nested routes.

Let's try to illustrate this with an example. Suppose that we want to add a list of winemakers to our application. We can add a new item to the navigation bar that allows us to navigate to a page showing that list.

The following screenshot shows how the new layout will appear:

So lets change the App components JSX markup as followsimport React - photo 2

So, let's change the App component's JSX markup, as follows:

import React, { Component } from 'react';
import './App.css';
import Catalog from './Catalog';
import About from './About';
import WineMakers from './WineMakers';
import { Switch, Route, Link } from 'react-router-dom';
class App extends Component {
render() {
return (

The Catalog App


  • Catalog

  • WineMakers

  • About



);
}
}
export default App;

We imported the WineMakers component, defined a route that maps the /winemakers path to the new component, and added a link to navigate to it.

We can implement the list of winemakers as follows:

import React from 'react';
import WineMaker from './WineMaker';
import { Switch, Route, Link } from 'react-router-dom';
class WineMakers extends React.Component {
renderWineMakersList() {
return

    ...
    Wine & Co
;
}
render() {
return
...
export default WineMakers;

The WineMakers component has the renderWineMakersList() method that returns the React element implementing a list of links to each winemaker. This method is used as the value of the render attribute of the route matching the /winemakers path in the render() method of the component. The other routes get the path pointing to each specific winemaker and render the WineMaker component according to the identifier code.

You may notice that we are implementing a view in the WineMakers component that is shown inside of the view implemented in the App component. In other words, we implement nested views by composing components that implement views.

Some Notes About the Route Component

Notice that the Route component has the path attribute (which allows us to specify the URL to map) and the component attribute (which allows us to assign the component to render in the current view):


path='/' component={Catalog}/>
path='/about' component={About}/>

The path attribute is used by React Router to detect the component to render, as specified by the corresponding component attribute.

In the previous route mapping, if we click on a Link component associated with the /about URL, the route with the root (/) path will match the starting part of /about, and the Catalog component will be rendered.

When the user requests a URL by clicking on the Link component, the list of routes is scanned in order to find a path value that matches the starting part of the URL. The first matching value determines the component to render.

If we want a strict comparison between the path attribute's value and the URL, we need to specify the exact attribute, which is shown as follows:


exact path='/' component={Catalog}/>

This prevents any URL starting with / from being captured by the first route.

The component attribute of the Route component allows us to specify the component to render. Alternatively, we can use the render attribute to specify the invocation of a function returning a React element, as shown in the following example:

()}/>

This approach is similar to using the component attribute, but it may be useful for inline rendering and when we need to pass values to the element.

The Route component also allows us to specify the children attribute. As with render, we can assign a function to this attribute, but the elements returned by that function will always be rendered, regardless of whether the path matches or not.

Consider the following example:


()}/>

The Footer component will always be rendered, even if the path /footer doesn't match.

Beginning React
Simplify your frontend development workflow and enhance the user experience of your applications with React
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React»

Look at similar books to Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React»

Discussion, reviews of the book Beginning React: Simplify Your Frontend Development Workflow and Enhance the User Experience of Your Applications With React and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.