• Complain

Stoyan Stefanov - React Up & Running: Building Web Applications

Here you can read online Stoyan Stefanov - React Up & Running: Building Web Applications full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. year: 2015, publisher: O’Reilly, 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.

Stoyan Stefanov React Up & Running: Building Web Applications
  • Book:
    React Up & Running: Building Web Applications
  • Author:
  • Publisher:
    O’Reilly
  • Genre:
  • Year:
    2015
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

React Up & Running: Building Web Applications: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "React Up & Running: Building Web Applications" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Hit the ground running with React, the open-source technology from Facebook for building rich web applications fast. With this practical guide, Facebook web developer Stoyan Stefanov teaches you how to build components--Reacts basic building blocks--and organize them into maintainable, large-scale apps. If youre familiar with basic javascript syntax, youre ready to get started.
Once you understand how React works, youll build a complete custom Whinepad app that helps users rate wines and keep notes. Youll quickly learn why some developers consider React the key to the web app development puzzle.
Set up React and write your first Hello world web app
Create and use custom React components alongside generic DOM components
Build a data table component that lets you edit, sort, search, and export its contents
Use the JSX syntax extension as an alternative to function calls
Set up a lean, low-level build process that helps you focus on React
Build a complete custom app that lets you store data on the client
Use ESLint, Flow, and Jest tools to check and test your code as your app evolves
Manage communication between components with Flux

Stoyan Stefanov: author's other books


Who wrote React Up & Running: Building Web Applications? Find out the surname, the name of the author of the book and a list of all author's works by series.

React Up & Running: Building Web Applications — 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 "React Up & Running: Building Web Applications" 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
ReactJS Up and Running
Stoyan Stefanov
Beijing Cambridge Farnham Kln Sebastopol Tokyo Chapter 1 Hello world Lets get - photo 1

Beijing Cambridge Farnham Kln Sebastopol Tokyo

Chapter 1. Hello world

Lets get started on the journey to mastering application development using React. In this chapter you will learn how to setup React and write your first Hello world application.

Setup

First things first: you need to get a copy of the React library. Luckily this is as simple as it can be. Go to http://reactjs.com (which should redirect you to the official GitHub home at http://facebook.github.io/react/), then click the Download button, then Download Starter Kit and youll get a copy of a zip file. Unzip and copy the directory contained in the download to a location where youll be able to find it.

For example

mkdir ~/reactbookmv ~/Downloads/react-0.13.3/ ~/reactbook/react

Now your working directory (reactbook) should look like .

Figure 1-1 Your React directory listing The only file you need to get started - photo 2
Figure 1-1. Your React directory listing

The only file you need to get started for the time being is ~/reactbook/react/build/react.js. Youll learn about all the others as you go along.

Note

At the time of writing 0.13.3 is the latest stable version.

Note that React doesnt impose any directory structure, youre free to move to a different directory or rename react.js however you see fit.

Hello React world

Lets start with a simple page in your working directory (~/reactbook/hello.html).

hello React charset="utf-8">
id="app">
src="react/build/react.js">// my app's code

There are only two notable things happening in this file:

  • you include the React library ()
  • you define where your application should be placed on the page (
    )
Note

You can always mix regular HTML content as well as other JavaScript libraries with a React app. You can also have several React apps on the same page. All you need is place in the DOM where you tell React: do you magic right here.

Now lets add the code that says hello. Update hello.html and replace // my app's code with:

React.render(React.DOM.h1(null,"Hello world!"),document.getElementById("app"));

Load hello.html in your browser and youll see your new app in action ()

Figure 1-2 Hello World in action Congratulations youve just built your first - photo 3
Figure 1-2. Hello World in action

Congratulations, youve just built your first React application!

also shows the generated code in Chrome Developer Tools where you can see that the contents of

placeholder was replaced with the contents generated by your React app.
What just happened?

There are few things of interest in the code that made your first app work.

First, you see the global React object. All of the APIs available to you are accessible via this object. And not to worry - the API is intentionally minimal, so there are not a lot of method names to remember.

Next, there is the concept of components . You build your UI using components and you combine these components in any way you see fit. In your applications youll end up creating your own custom components, but to get you off the ground, React provides wrappers around HTML DOM elements. You use the wrappers via the React.DOM object. In this first example, you can see the use of the h1 component. It corresponds to the

HTML element and is available to you using a call to React.DOM.h1().

Finally, you see good old school document.getElementById("app") DOM access. You use this to tell React where the application should be located in the page. This is the bridge crossing over from the DOM manipulation as you know it to the React-land.

Note

Once you cross the bridge from DOM to React, you dont have to worry about DOM manipulation anymore, because React does the translation from components to the underlying platform (browser DOM, canvas, native app). You dont have to worry about DOM but that doesnt mean you cannot. React gives you escape latches if you want to go back to DOM-land for any reason you may need.

Now that you know what each line does, lets take a look at the big picture. What happened is this: you rendered one React component in a DOM location of your choice. You always render one top-level component and it can have as many children (and grandchildren, and so on) components as you need. In fact even in this simple example, the h1 component has a child - the Hello world! text.

React.DOM.*

AS you know now, you can use a number of HTML elements as React components via React.DOM object ( shows you how to get a full list using your browser console). Lets take a close look at this API.

Figure 1-3 List of ReactDOM properties Remember the hello world app looked - photo 4
Figure 1-3. List of React.DOM properties

Remember the hello world app looked like this:

React.DOM.h1(null,"Hello world!");

The first parameter (null in this case) is an object that specifies any properties (think DOM attributes) that you want to pass to your component. For example you can do:

React.DOM.h1({id:"my-heading"},"Hello world!");

The HTML generated by this example is shown on .

Figure 1-4 HTML generated by a ReactDOM call The second parameter Hello - photo 5
Figure 1-4. HTML generated by a React.DOM call

The second parameter ("Hello world!" in this example) defines a child of the component. The simplest case is just a text child (a Text node in DOM-speak) as you see above. But you can have as many nested children as you like and you pass them as additional parameters. For example:

React.DOM.h1({id:"my-heading"},React.DOM.span(null,"Hello")," world!");

Another example, this time with nested components:

React.
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «React Up & Running: Building Web Applications»

Look at similar books to React Up & Running: Building Web Applications. 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 «React Up & Running: Building Web Applications»

Discussion, reviews of the book React Up & Running: Building Web Applications 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.