SlideShare a Scribd company logo
Hands on: React Native
By Er.Jay Nagar
www.jaynagarblog.wordpress.com
About me:
: Diploma in IT, BE In IT
● Technology: PHP,JS,HTML,CSS
● Community: GDG , Mozilla , GirlScript
Agenda
● RN introduction
● Brief about technologies it depends on (JSX, ES6)
● Environment setup & RN cli
● Components
● Component lifecycle
● Basic and custom components
● API integration & Navigation
www.jaynagarblog.wordpress.com
Code and output
$ git clone https://github.com/sagark1510/RNHandsOn
$ cd RNHandsOn
$ npm install
$ react-native run-android
$ git checkout fbf8d19
www.jaynagarblog.wordpress.com
What is React Native?
RN is framework for building mobile apps using ReactJs & Javascript
Builds cross-platform mobile apps
Uses most of all the ReactJs features
www.jaynagarblog.wordpress.com
Why I should learn React Native?
1. You can start RN app dev in no time if you already know ReactJS
2. 80% code is common
3. Less expensive / Cost effective
4. Easier to code and scale
5. Save massive amount of time
1. Hybrid is more like hack than a solution
2. Performance was biggest issue in Hybrid
3. Debugging is faster than ever compare to native
4. No need to recompile for every change as native
React Native vs Hybrid Apps vs Native Apps
www.jaynagarblog.wordpress.com
ES6
Features of ES6
1. Classes
2. Arrows function
3. Template string
4. Object and Array destructuring
5. Let & Const
6. Modules import, export
7. Promise
https://github.com/DrkSephy/es6-cheatsheet
www.jaynagarblog.wordpress.com
React Native environment setup
Environment setup guide:
https://facebook.github.io/react-native/docs/getting-started.html
www.jaynagarblog.wordpress.com
Create your first project
1. $ npm install -g react-native-cli
2. $ react-native init RNHandsOn
3. $ cd RNHandsOn
4. $ react-native run-android
Or
$ react-native run-ios
Project folder structure
Index
Package.json
Android
iOS
www.jaynagarblog.wordpress.com
JSX
Let see how it works
https://babeljs.io/repl/
What is component?
● Everything what you see in RN app is
component.
● It’s a reusable piece of code
Component life cycle
Mounting
Lifecycle
● constructor(props)
● componentWillMount()
● render()
● componentDidMount()
Updating Lifecycle
● componentWillReceiveProps()
● shouldComponentUpdate()
● componentWillUpdate()
● render()
● componentDidUpdate()
Basic components of React Native
● View
● Text
● Image
● TextInput
● Touchables/Button
● ScrollView
$ git checkout ab77077
What is Props in React Component?
www.jaynagarblog.wordpress.com
What is State in React Component?
● Two type of data
controls component
Props & State
● Props are controlled
by parent component
● State is used to
change internal UI/
Data of the
component
Counter example for State demonstration.
$ git checkout c494ae8
www.jaynagarblog.wordpress.com
Debugging in RN
Styling in React Native Component
● Built in component has
STYLE attribute.
● Style can be inline or
external object
● Use StyleSheet.create
Style - Flexbox
● What is FlexBox
● Let’s make a layout using FlexBox
$ git checkout c9a2b6a
www.jaynagarblog.wordpress.com
Custom Component
Smart Component
● “C” of “MVC” architecture.
● It is also known as
Containers
● It handles how thing works
● Does the data fetching and
Provides application data &
handle events / actions
Dumb Component
● “V” of “MVC” architecture.
● It is also known as stateless
component
● It handles how things looks
● It has only props, callbacks
which are provided by smart
component
www.jaynagarblog.wordpress.com
Example of Custom Components
Dumb Component Smart Component
Navigation in React Native
$npm install --save react-navigation
Login example
Example of Login using React Navigation and AsyncStorage.
$ git checkout a7bd54e
$ git checkout 95dbd39
www.jaynagarblog.wordpress.com
Working with Remote data - Fetch API
● Fetch API gives the
global fetch method for
accessing and
manipulating parts of
HTTP pipeline.
● Earlier we were using
XMLHttpRequest for
AJAX calls but this new
Fetch api will replace it
soon all over.
FlatList with static & Dynamic content example
$ git checkout 169e7c6
www.jaynagarblog.wordpress.com
Any Question?
THANK YOU :)
Ad

More Related Content

What's hot (20)

Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Polidea
 
React Native for multi-platform mobile applications - Matteo Manchi - Codemo...
React Native for multi-platform mobile applications  - Matteo Manchi - Codemo...React Native for multi-platform mobile applications  - Matteo Manchi - Codemo...
React Native for multi-platform mobile applications - Matteo Manchi - Codemo...
Codemotion
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Sambhu Lakshmanan
 
Creating books app with react native
Creating books app with react nativeCreating books app with react native
Creating books app with react native
Ali Sa'o
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 
Introduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / GraphsIntroduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / Graphs
Rahat Khanna a.k.a mAppMechanic
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
Barak Cohen
 
A tour of React Native
A tour of React NativeA tour of React Native
A tour of React Native
Tadeu Zagallo
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Rami Sayar
 
Lo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJSLo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJS
Marcel Kalveram
 
What's This React Native Thing I Keep Hearing About?
What's This React Native Thing I Keep Hearing About?What's This React Native Thing I Keep Hearing About?
What's This React Native Thing I Keep Hearing About?
Evan Stone
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
Adrian Philipp
 
From zero to hero with React Native!
From zero to hero with React Native!From zero to hero with React Native!
From zero to hero with React Native!
Commit University
 
An iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React NativeAn iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React Native
Aleksandras Smirnovas
 
When to (use / not use) React Native.
When to (use / not use) React Native.When to (use / not use) React Native.
When to (use / not use) React Native.
Bobby Schultz
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile Apps
Jimit Shah
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
dvcrn
 
React native
React nativeReact native
React native
Omid Nikrah
 
Some experiences building an Android app with React Native & Redux
Some experiences building an Android app with React Native & ReduxSome experiences building an Android app with React Native & Redux
Some experiences building an Android app with React Native & Redux
Alex Bepple
 
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
Codemotion
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Polidea
 
React Native for multi-platform mobile applications - Matteo Manchi - Codemo...
React Native for multi-platform mobile applications  - Matteo Manchi - Codemo...React Native for multi-platform mobile applications  - Matteo Manchi - Codemo...
React Native for multi-platform mobile applications - Matteo Manchi - Codemo...
Codemotion
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Sambhu Lakshmanan
 
Creating books app with react native
Creating books app with react nativeCreating books app with react native
Creating books app with react native
Ali Sa'o
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 
Introduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / GraphsIntroduction to React Native & Rendering Charts / Graphs
Introduction to React Native & Rendering Charts / Graphs
Rahat Khanna a.k.a mAppMechanic
 
React Native for ReactJS Devs
React Native for ReactJS DevsReact Native for ReactJS Devs
React Native for ReactJS Devs
Barak Cohen
 
A tour of React Native
A tour of React NativeA tour of React Native
A tour of React Native
Tadeu Zagallo
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Rami Sayar
 
Lo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJSLo mejor y peor de React Native @ValenciaJS
Lo mejor y peor de React Native @ValenciaJS
Marcel Kalveram
 
What's This React Native Thing I Keep Hearing About?
What's This React Native Thing I Keep Hearing About?What's This React Native Thing I Keep Hearing About?
What's This React Native Thing I Keep Hearing About?
Evan Stone
 
Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016Experiences building apps with React Native @DomCode 2016
Experiences building apps with React Native @DomCode 2016
Adrian Philipp
 
From zero to hero with React Native!
From zero to hero with React Native!From zero to hero with React Native!
From zero to hero with React Native!
Commit University
 
An iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React NativeAn iOS Developer's Perspective on React Native
An iOS Developer's Perspective on React Native
Aleksandras Smirnovas
 
When to (use / not use) React Native.
When to (use / not use) React Native.When to (use / not use) React Native.
When to (use / not use) React Native.
Bobby Schultz
 
React native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile AppsReact native - React(ive) Way To Build Native Mobile Apps
React native - React(ive) Way To Build Native Mobile Apps
Jimit Shah
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
dvcrn
 
Some experiences building an Android app with React Native & Redux
Some experiences building an Android app with React Native & ReduxSome experiences building an Android app with React Native & Redux
Some experiences building an Android app with React Native & Redux
Alex Bepple
 
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
React Native - Unleash the power of React in your device - Eduard Tomàs - Cod...
Codemotion
 

Similar to Hands on react native (20)

Introduction to react native @ TIC NUST
Introduction to react native @ TIC NUSTIntroduction to react native @ TIC NUST
Introduction to react native @ TIC NUST
Waqqas Jabbar
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)
Jarek Potiuk
 
Web summit.pptx
Web summit.pptxWeb summit.pptx
Web summit.pptx
171SagnikRoy
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov
 
Deploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOpsDeploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOps
Opsta
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 
Integrating react in django while staying sane and happy
Integrating react in django while staying sane and happyIntegrating react in django while staying sane and happy
Integrating react in django while staying sane and happy
Fröjd Interactive
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
Fwdays
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
From React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I startedFrom React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I started
sparkfabrik
 
Pluggable web app using Angular (Odessa JS conf)
Pluggable web app using Angular (Odessa JS conf)Pluggable web app using Angular (Odessa JS conf)
Pluggable web app using Angular (Odessa JS conf)
Saif Jerbi
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
Nadav Mary
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
Jumping Bean
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
Deepak Garg
 
React native
React nativeReact native
React native
Christopher Kollars
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
Introduction to react native @ TIC NUST
Introduction to react native @ TIC NUSTIntroduction to react native @ TIC NUST
Introduction to react native @ TIC NUST
Waqqas Jabbar
 
20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native20180518 QNAP Seminar - Introduction to React Native
20180518 QNAP Seminar - Introduction to React Native
Eric Deng
 
React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)React native introduction (Mobile Warsaw)
React native introduction (Mobile Warsaw)
Jarek Potiuk
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
Stanislav Petrov
 
Deploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOpsDeploy 22 microservices from scratch in 30 mins with GitOps
Deploy 22 microservices from scratch in 30 mins with GitOps
Opsta
 
Angular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - LinagoraAngular (v2 and up) - Morning to understand - Linagora
Angular (v2 and up) - Morning to understand - Linagora
LINAGORA
 
Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"Philip Shurpik "Architecting React Native app"
Philip Shurpik "Architecting React Native app"
Fwdays
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
Waqqas Jabbar
 
Integrating react in django while staying sane and happy
Integrating react in django while staying sane and happyIntegrating react in django while staying sane and happy
Integrating react in django while staying sane and happy
Fröjd Interactive
 
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa..."Crafting a Third-Party Banking Library with Web Components and React", Germa...
"Crafting a Third-Party Banking Library with Web Components and React", Germa...
Fwdays
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
GDSC UofT Mississauga
 
From React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I startedFrom React to React Native - Things I wish I knew when I started
From React to React Native - Things I wish I knew when I started
sparkfabrik
 
Pluggable web app using Angular (Odessa JS conf)
Pluggable web app using Angular (Odessa JS conf)Pluggable web app using Angular (Odessa JS conf)
Pluggable web app using Angular (Odessa JS conf)
Saif Jerbi
 
Angular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHEREAngular elements - embed your angular components EVERYWHERE
Angular elements - embed your angular components EVERYWHERE
Nadav Mary
 
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...Client vs Server Templating: Speed up initial load for SPA with Angular as an...
Client vs Server Templating: Speed up initial load for SPA with Angular as an...
David Amend
 
React - The JavaScript Library for User Interfaces
React - The JavaScript Library for User InterfacesReact - The JavaScript Library for User Interfaces
React - The JavaScript Library for User Interfaces
Jumping Bean
 
Google app-engine-with-python
Google app-engine-with-pythonGoogle app-engine-with-python
Google app-engine-with-python
Deepak Garg
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
Chiew Carol
 
Ad

More from Jay Nagar (20)

11 best tips to grow your influence youtube
11 best tips to grow your influence youtube11 best tips to grow your influence youtube
11 best tips to grow your influence youtube
Jay Nagar
 
Impact of micro vs macro influencers in 2022
Impact of micro vs macro influencers in 2022Impact of micro vs macro influencers in 2022
Impact of micro vs macro influencers in 2022
Jay Nagar
 
What is Signature marketing
What is Signature marketingWhat is Signature marketing
What is Signature marketing
Jay Nagar
 
100+ Guest blogging sites list
100+ Guest blogging sites list100+ Guest blogging sites list
100+ Guest blogging sites list
Jay Nagar
 
Ethical Hacking and Defense Penetration
Ethical Hacking and Defense PenetrationEthical Hacking and Defense Penetration
Ethical Hacking and Defense Penetration
Jay Nagar
 
Cyber Security and Cyber Awareness Tips manual 2020
Cyber Security and Cyber Awareness Tips manual 2020Cyber Security and Cyber Awareness Tips manual 2020
Cyber Security and Cyber Awareness Tips manual 2020
Jay Nagar
 
On-Page SEO Techniques By Digitech Jay
On-Page SEO Techniques By Digitech JayOn-Page SEO Techniques By Digitech Jay
On-Page SEO Techniques By Digitech Jay
Jay Nagar
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
Jay Nagar
 
Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness
Jay Nagar
 
Cyber security and Privacy Awareness manual
Cyber security and Privacy Awareness manual Cyber security and Privacy Awareness manual
Cyber security and Privacy Awareness manual
Jay Nagar
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Jay Nagar
 
Bluethooth Protocol stack/layers
Bluethooth Protocol stack/layersBluethooth Protocol stack/layers
Bluethooth Protocol stack/layers
Jay Nagar
 
GPRS(General Packet Radio Service)
GPRS(General Packet Radio Service)GPRS(General Packet Radio Service)
GPRS(General Packet Radio Service)
Jay Nagar
 
Communication and Networking
Communication and NetworkingCommunication and Networking
Communication and Networking
Jay Nagar
 
MOBILE COMPUTING and WIRELESS COMMUNICATION
MOBILE COMPUTING and WIRELESS COMMUNICATION MOBILE COMPUTING and WIRELESS COMMUNICATION
MOBILE COMPUTING and WIRELESS COMMUNICATION
Jay Nagar
 
Global system for mobile communication(GSM)
Global system for mobile communication(GSM)Global system for mobile communication(GSM)
Global system for mobile communication(GSM)
Jay Nagar
 
Python for beginners
Python for beginnersPython for beginners
Python for beginners
Jay Nagar
 
Earn Money from bug bounty
Earn Money from bug bountyEarn Money from bug bounty
Earn Money from bug bounty
Jay Nagar
 
Code smell & refactoring
Code smell & refactoringCode smell & refactoring
Code smell & refactoring
Jay Nagar
 
The Diffie-Hellman Algorithm
The Diffie-Hellman AlgorithmThe Diffie-Hellman Algorithm
The Diffie-Hellman Algorithm
Jay Nagar
 
11 best tips to grow your influence youtube
11 best tips to grow your influence youtube11 best tips to grow your influence youtube
11 best tips to grow your influence youtube
Jay Nagar
 
Impact of micro vs macro influencers in 2022
Impact of micro vs macro influencers in 2022Impact of micro vs macro influencers in 2022
Impact of micro vs macro influencers in 2022
Jay Nagar
 
What is Signature marketing
What is Signature marketingWhat is Signature marketing
What is Signature marketing
Jay Nagar
 
100+ Guest blogging sites list
100+ Guest blogging sites list100+ Guest blogging sites list
100+ Guest blogging sites list
Jay Nagar
 
Ethical Hacking and Defense Penetration
Ethical Hacking and Defense PenetrationEthical Hacking and Defense Penetration
Ethical Hacking and Defense Penetration
Jay Nagar
 
Cyber Security and Cyber Awareness Tips manual 2020
Cyber Security and Cyber Awareness Tips manual 2020Cyber Security and Cyber Awareness Tips manual 2020
Cyber Security and Cyber Awareness Tips manual 2020
Jay Nagar
 
On-Page SEO Techniques By Digitech Jay
On-Page SEO Techniques By Digitech JayOn-Page SEO Techniques By Digitech Jay
On-Page SEO Techniques By Digitech Jay
Jay Nagar
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
Jay Nagar
 
Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness Cyber Security and Cyber Awareness
Cyber Security and Cyber Awareness
Jay Nagar
 
Cyber security and Privacy Awareness manual
Cyber security and Privacy Awareness manual Cyber security and Privacy Awareness manual
Cyber security and Privacy Awareness manual
Jay Nagar
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
Jay Nagar
 
Bluethooth Protocol stack/layers
Bluethooth Protocol stack/layersBluethooth Protocol stack/layers
Bluethooth Protocol stack/layers
Jay Nagar
 
GPRS(General Packet Radio Service)
GPRS(General Packet Radio Service)GPRS(General Packet Radio Service)
GPRS(General Packet Radio Service)
Jay Nagar
 
Communication and Networking
Communication and NetworkingCommunication and Networking
Communication and Networking
Jay Nagar
 
MOBILE COMPUTING and WIRELESS COMMUNICATION
MOBILE COMPUTING and WIRELESS COMMUNICATION MOBILE COMPUTING and WIRELESS COMMUNICATION
MOBILE COMPUTING and WIRELESS COMMUNICATION
Jay Nagar
 
Global system for mobile communication(GSM)
Global system for mobile communication(GSM)Global system for mobile communication(GSM)
Global system for mobile communication(GSM)
Jay Nagar
 
Python for beginners
Python for beginnersPython for beginners
Python for beginners
Jay Nagar
 
Earn Money from bug bounty
Earn Money from bug bountyEarn Money from bug bounty
Earn Money from bug bounty
Jay Nagar
 
Code smell & refactoring
Code smell & refactoringCode smell & refactoring
Code smell & refactoring
Jay Nagar
 
The Diffie-Hellman Algorithm
The Diffie-Hellman AlgorithmThe Diffie-Hellman Algorithm
The Diffie-Hellman Algorithm
Jay Nagar
 
Ad

Hands on react native

  • 1. Hands on: React Native By Er.Jay Nagar www.jaynagarblog.wordpress.com
  • 2. About me: : Diploma in IT, BE In IT ● Technology: PHP,JS,HTML,CSS ● Community: GDG , Mozilla , GirlScript
  • 3. Agenda ● RN introduction ● Brief about technologies it depends on (JSX, ES6) ● Environment setup & RN cli ● Components ● Component lifecycle ● Basic and custom components ● API integration & Navigation www.jaynagarblog.wordpress.com
  • 4. Code and output $ git clone https://github.com/sagark1510/RNHandsOn $ cd RNHandsOn $ npm install $ react-native run-android $ git checkout fbf8d19 www.jaynagarblog.wordpress.com
  • 5. What is React Native? RN is framework for building mobile apps using ReactJs & Javascript Builds cross-platform mobile apps Uses most of all the ReactJs features www.jaynagarblog.wordpress.com
  • 6. Why I should learn React Native? 1. You can start RN app dev in no time if you already know ReactJS 2. 80% code is common 3. Less expensive / Cost effective 4. Easier to code and scale 5. Save massive amount of time
  • 7. 1. Hybrid is more like hack than a solution 2. Performance was biggest issue in Hybrid 3. Debugging is faster than ever compare to native 4. No need to recompile for every change as native React Native vs Hybrid Apps vs Native Apps www.jaynagarblog.wordpress.com
  • 8. ES6 Features of ES6 1. Classes 2. Arrows function 3. Template string 4. Object and Array destructuring 5. Let & Const 6. Modules import, export 7. Promise https://github.com/DrkSephy/es6-cheatsheet www.jaynagarblog.wordpress.com
  • 9. React Native environment setup Environment setup guide: https://facebook.github.io/react-native/docs/getting-started.html www.jaynagarblog.wordpress.com
  • 10. Create your first project 1. $ npm install -g react-native-cli 2. $ react-native init RNHandsOn 3. $ cd RNHandsOn 4. $ react-native run-android Or $ react-native run-ios
  • 12. JSX Let see how it works https://babeljs.io/repl/
  • 13. What is component? ● Everything what you see in RN app is component. ● It’s a reusable piece of code
  • 14. Component life cycle Mounting Lifecycle ● constructor(props) ● componentWillMount() ● render() ● componentDidMount() Updating Lifecycle ● componentWillReceiveProps() ● shouldComponentUpdate() ● componentWillUpdate() ● render() ● componentDidUpdate()
  • 15. Basic components of React Native ● View ● Text ● Image ● TextInput ● Touchables/Button ● ScrollView $ git checkout ab77077
  • 16. What is Props in React Component? www.jaynagarblog.wordpress.com
  • 17. What is State in React Component? ● Two type of data controls component Props & State ● Props are controlled by parent component ● State is used to change internal UI/ Data of the component
  • 18. Counter example for State demonstration. $ git checkout c494ae8 www.jaynagarblog.wordpress.com
  • 20. Styling in React Native Component ● Built in component has STYLE attribute. ● Style can be inline or external object ● Use StyleSheet.create
  • 21. Style - Flexbox ● What is FlexBox ● Let’s make a layout using FlexBox $ git checkout c9a2b6a www.jaynagarblog.wordpress.com
  • 22. Custom Component Smart Component ● “C” of “MVC” architecture. ● It is also known as Containers ● It handles how thing works ● Does the data fetching and Provides application data & handle events / actions Dumb Component ● “V” of “MVC” architecture. ● It is also known as stateless component ● It handles how things looks ● It has only props, callbacks which are provided by smart component www.jaynagarblog.wordpress.com
  • 23. Example of Custom Components Dumb Component Smart Component
  • 24. Navigation in React Native $npm install --save react-navigation
  • 25. Login example Example of Login using React Navigation and AsyncStorage. $ git checkout a7bd54e $ git checkout 95dbd39 www.jaynagarblog.wordpress.com
  • 26. Working with Remote data - Fetch API ● Fetch API gives the global fetch method for accessing and manipulating parts of HTTP pipeline. ● Earlier we were using XMLHttpRequest for AJAX calls but this new Fetch api will replace it soon all over.
  • 27. FlatList with static & Dynamic content example $ git checkout 169e7c6 www.jaynagarblog.wordpress.com