• Complain

Jonathan Lebensold [Lebensold - React Native Cookbook: Bringing the Web to Native Platforms

Here you can read online Jonathan Lebensold [Lebensold - React Native Cookbook: Bringing the Web to Native Platforms 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: O’Reilly Media, 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.

Jonathan Lebensold [Lebensold React Native Cookbook: Bringing the Web to Native Platforms

React Native Cookbook: Bringing the Web to Native Platforms: summary, description and annotation

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

Tackling an app development project on multiple platforms is no simple task. When time is in short supply and customers need access from the tap of a home screen, React Native can provide a lean development team with the tools needed to deliver a multi-platform native experience without juggling multiple programming languages and shifting code bases. React Native is an emerging technology and best practices are only beginning to bubble up.

Fortunately, a growing user communityfrom tech giants such as Facebook, Yahoo, and Airbnb to the independent developersis hard at work codifying patterns and best practices for how to use React Native. This cookbook is another milestone on that journey.

Aimed at people with some JavaScript and web development experience, the first part of this cookbook covers some simple tips for getting started with React Native. Part 2 will cover some emerging patterns that are commonly found in most native applications.

**

Jonathan Lebensold [Lebensold: author's other books


Who wrote React Native Cookbook: Bringing the Web to Native Platforms? Find out the surname, the name of the author of the book and a list of all author's works by series.

React Native Cookbook: Bringing the Web to Native Platforms — 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 Native Cookbook: Bringing the Web to Native Platforms" 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
Chapter 1. The React Native Toolchain

React Native lives in an ecosystem with dozens of little software tools. Youhave transpilers (Babel, Metro, Webpack), package managers (NPM, Yarn), linters, unittest frameworks, and more. This chapter will cover the language basics and theminimum set of open source tools you will be working with in your React Nativeproject. Youre probably writing your React Native application with JavaScriptor some kind of transpiled source that compiles down to JavaScript, likeTypeScript or ES6+. I hope this chapter will help acquaint you withJavaScripts breakneck speed.

Expo

Recently the React Native team has partnered with Expo todeliver React Native applications in development without running a localdevelopment environment. This is a great way to explore React Native and get ataste, but you will likely want to work with the hardware at some point, atwhich point a local development environment will be critical to yourproductivity.

1.1 Setting Up Your Development Environment

If youre working with any of these tools in other web projects, you might find yourselfhaving to troubleshoot your environment. Like a carpenter arriving on a jobsite, you need to know how all the tools work and if they need to be fixed.

React Native is a package that includes three programming environments:Node.js, iOS, and Android. NPM, the Node Package Manager, needs to be in goodworking order.

Problem

React Native is a software library that depends on a lot of different tools. Howdo we know if all of them are configured correctly? Lets review them and make sure.

Node and Watchman

Node.js (usually abbreviated to Node) enables your computer to run JavaScriptlocally in the same way that a web browser runs JavaScript when a web page isexecuted. Because Node.js runs directly on top of your operating system, Nodecode can wrap or bind to C libraries and solve the same programming problemsthat are suited to languages like PHP, Python, PERL, and Ruby.

Watchman is a little utility that watches for file changes locally and triggersevents. This tool makes it possible to execute updated code on your Simulatorwithout having to recompile the whole project. Installation isquick and easy.

Installing Node.js

Installing Node depends on your operating system. The best place to get startedis The Node.js website. If you are running on Mac OS, you mayfind it preferable to install Node.js through Homebrew, a Mac OS packagemanager.

Check that Node is properly installed

You may find yourself with many versions of Node.js installed on your computer.Version managers like the Node Version Manager (NVM) can help you keep differentversions of Node installed, with each development project configured with itsown version of Node.

POSIX-style operating systems (Linux, BSD, Mac OS) can rely on symbolic links(symlink) to support multiple versions.

You shouldnt be surprised if you have two versions of Node installed usingHomebrew with Mac OS. This is what your installation should look like, exceptwith your own username and date information next to the directories listed:

$> which node/usr/local/bin/node$> node -vv8.6.0

Im using version 8.6.0 of Node; however, if I check the Homebrew directory (default is /usr/local/Cellar) Iwill discover a symlink (alias to the actual location):

$>ls -l /usr/local/bin/nodelrwxr-xr-x 1 jon admin 2927 Sep 15:14 /usr/local/bin/node ->../Cellar/node/8.6.0/bin/node

A little more digging and Ill find other versions of Node that have beensuperseded:

$>ls -l /usr/local/Cellar/node total 0 drwxr-xr-x 14 jon admin 47611 May 14:14 7.10.0 drwxr-xr-x 14 jon admin 47625 Apr 13:41 7.9.0 drwxr-xr-x 14 jon admin 44827 Sep 15:14 8.6.0

Your results will likely be different; however, what is important is that youhave a recent version of Node installed and accessible to your project.

NPM

The NPM is two things: a package management tool runningfrom the command line and a global catalog of open source packages available atyour fingertips.

The react-native package in NPM includes JavaScript ES6 modules thatrely on platform-specific code. For example, the React Native componentis implemented by RCTText.m in iOS and ReactTextView.java in Android.

What About Using Yarn?

React Native has historically been set up with NPM, but Yarn is gainingground in the JavaScript community. Yarn is a faster alternative to NPM thatstill relies on the NPM registry. A yarn.lock file ensures that dependenciesare maintained correctly. Yarn will start by checking the yarn.lock file, thenlook for package.json, making the transition to Yarn seamless.

NPM packages can live globally or within a node_modules folder for a givenproject. React Native is best installed globally, whereas project-relateddependencies should be downloaded to a local folder. This approach allows you torun React Natives command-line tool, react-native-cli, anywhere. Specific versionsof the React Native can be part of your projects dependencies.

Check that NPM is properly installed
$> which npm/usr/local/bin/npm

Your terminal should return with a path. Check the version:

$> npm -v4.2.0
Install the React Native command-line tools
$> npm install -g react-native-cli
Xcode (required for iOS)

Xcode is Apples official development environment for building and runningapplicationson Mac OS and iOS. You will need Xcode (available only on Mac OS) installed inorder to compile the React Native components that are backed by Objective-C andSwift.

Xcode also ships with command-line tools, which are necessary to build code fromthe command line and to bind to the Mac OS libraries from Node.js.

Running Xcode Beta

With regular updates to iOS, you may have a beta of Xcodeon your development machine. Having multiple versions of Xcode will result inmultiple versions of the iOS Simulator. Ive found it best under thesecircumstances to launch the Simulator from Xcode rather than the command line.

JDK

Android and Java go together like sugar and buttertogether they makedelicious experiences possible. React Native on Android is no different. TheReact components you write in JavaScript will ultimately touch the Android JavaVirtual Machine. In order to run Android locally, you need the Java DevelopmentKit (JDK) installed.

Download the JDK (minimum version 8) from the Oracle website.

Android Studio

Android Studio is the official development environment for building anddeploying Android applications. Itsfree to download. Once you haveit set up, it comes with yet another package manager. Fortunately, the ReactNative Getting Started guide goes throughall thedetails step by step.

1.2 Writing ES6 with Babel

Babel brings a 20-year programming language into the twenty-first century. With Babel,you can write JavaScript with some syntactic enhancements that make your codemore expressive. Common patterns, like transforming data structures, handlingthis in the appropriate scope, and inheriting from classes become part of thenative development experience.

Babel enables these syntactic improvements to the language through a series of

Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «React Native Cookbook: Bringing the Web to Native Platforms»

Look at similar books to React Native Cookbook: Bringing the Web to Native Platforms. 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 Native Cookbook: Bringing the Web to Native Platforms»

Discussion, reviews of the book React Native Cookbook: Bringing the Web to Native Platforms 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.