SlideShare a Scribd company logo
INTRODUCTIONTO
REACT NATIVE WITH
REDUX
Michael Melusky - @mrjavascript
Philly.NET – March 24, 2018
Topics
• Introduction to React:
• Components
• Props
• State
• React Native
• Build a sample app!
• Advanced React Native Concepts
• Navigation
• Redux Persist
• Compare and contrast to other “Native” frameworks
About Speaker
• Michael Melusky
• Software Developer atAudacious Inquiry (Baltimore, MD)
• Faculty member at Penn State Harrisburg and Franklin and MarshallCollege
• @mrjavascript (Twitter/GitHub)
• @melusky (XBOX)
Any prerequisites?
• HTML5
• CSS3
• JavaScript (ES6/TypeScript)
• Node / NPM
• https://nodejs.org/en/download/
• Development IDE:
• Atom (Github)
• Visual Studio Code (Microsoft)
• WebStorm (JetBrains)
REACT
What is React?
• JavaScript framework for building user interfaces
• Maintained by Facebook
• Based off of a Component model (Similar to Angular 2/4)
React Components
• Building blocks for React applications
• Written in JSX:
• Allows you to embed HTML tags inside of JavaScript
React Components – Shopping List
React Components
• Written in ES6/JSX
• Browsers understand plain vanilla JavaScript
• Babel transpiles the ES6/JSX into vanilla JavaScript for the browsers
• Source-to-source compiler
React Components – Shopping Cart
React Components – Shopping Cart
PROPS AND STATE
Communication between Components
• Two ways to communicate between React components:
• Props
• Allows arbitrary inputs to be passed as inputs to components
• Used for parent child communication
• State
• state is used to store data used in the current page
• A parent component’s state often becomes a child component’s props
ReactTutorial
• https://codepen.io/gaearon/pen/gWWZgR?editors=0010
React Components –TTT Square
React Components –TTT Board
REACT NATIVE
React Native
• A framework for building mobile apps (iOS/Android) using JavaScript!
• Uses the same component model React web apps use
• Which “apps” are using React Native?
• Facebook
• Instagram
• Airbnb
• Skype (MicrosoftTeams)
• Walmart
• Yes Microsoft is using React Native actively!
Let’s Build a React NativeApp!
Let’s Build a React NativeApp!
Let’s Build a React NativeApp!
Let’s Build a React NativeApp!
• ** DEMO **
REACT COMPONENTS
Basic Components
User Interface
ListViews
Others
Others
NATIVE NAVIGATION
Community Solutions
• For handling Navigation, Facebook recommends a pair of community modules:
• react-navigation
• react-native-navigation
• https://github.com/wix/react-native-navigation
React Navigation
React Navigation
• A number of navigators can be used:
• StackNavigator - Renders one screen at a time and provides transitions between
screens.When a new screen is opened it is placed on top of the stack.
• (in Xamarin, NavigationPage)
• TabNavigator - Renders a tab bar that lets the user switch between several screens
• (In Xamarin,TabbedPage)
• DrawerNavigator - Provides a drawer that slides in from the left of the screen
• (In Xamarin, MasterDetailPage)
Stack Navigator
Stack Navigator
Stack Navigator
• ** DEMO **
REDUX
React and Redux
Redux
• A number of frameworks exist for state management:
• Redux
• MobX
• React actually ships with its own component state management (this.state)
• Can be used with any framework (Ember, jQuery, Angular, et al.)
Why Redux?
• Redux is a predictable state container for JavaScript apps.
• There are many states in an app that will change depending on time, user
behavior, or a plethora of different reasons.
• Thus, if we consider an app as the process to change its own state, the view a user
sees is how the states are presented.
How does Redux Work?
• Redux can be broken down into the following:
• store: manages the states. Mainly there is a dispatch method to dispatch an action. In a
Redux app, you can obtain its states via store.getState()
• action: a simple, plain JavaScript object. An action can also be considered as a command to
change a state.
• reducer: decides how to change a state after receiving an action, and thus can be considered
the entrance of a state change. A reducer is comprised of functions, and it changes states by
taking an action as an argument, in which it then returns a new state.
• Is a pure function:
• Doesn’t alter input data
• Doesn’t depend on external state (database, DOM) and consistently produces the same output for same input
• middleware: the middleman between a store.dispatch() and a reducer. Its purpose is to
intercept an action that has been dispatched, and modify or even cancel the action before it
reaches the reducer.
Redux
• ** DEMO **
OTHER FRAMEWORKS
Source: https://cruxlab.com/blog/reactnative-vs-xamarin/
Compare and Contrast
Xamarin React Native Ionic
Language C# JavaScript TypeScript
Native Widgets yes yes no
General ideas Staying close to native Functional approach: UI
is a function of state
Use web technologies
for maximum
portability
Measuring Performance
• JIT and AOT
• JIT – Just inTime
• Just-in-time compilation (JIT) is the process of compiling a bytecode or a source code
into the native code at runtime.
• Hence, a piece of code (bytecode or source code) is not interpreted at runtime every
time it gets executed, but it’s only interpreted once at runtime, and every next time
it is executed, a fast native code runs.
• AOT – Ahead ofTime
• Ahead-of-time compilation (AOT) is the same process performed before starting the
application, at compile time
AOT or JIT?
• Both C# and JavaScript are not compiled into the native code of the target CPU.
C# is compiled into some bytecode, and JavaScript is interpreted.Thus, the
performance question arises
• You might think AOT is always better than JIT, because you only need to compile
once and not every time you start the program
• But let’s remember that JavaScript is a dynamically typed language, and this is the
reason why JIT can outperform AOT in JavaScript case
Compare and Contrast (Continued)
RESOURCES
Additional Resources
• https://react.christmas/
• ReactTutorial in “Advent Calendar” format
• https://twitter.com/dan_abramov
• Twitter of Redux creator
• https://www.reddit.com/r/reactjs/
• Subreddit for React
• https://github.com/fbsamples/f8app
• F8 conference app, great React Native demo
Thank you for coming
• https://twitter.com/mrjavascript/
• https://github.com/mrjavascript

More Related Content

PPTX
An evening with React Native
PPTX
React Native
PDF
Introduction to React Native & Rendering Charts / Graphs
PDF
React native: building native iOS apps with javascript
PDF
React + Redux for Web Developers
PDF
Getting Started with React Native (and should I use it at all?)
PDF
Introduction to react native
PPTX
Creating books app with react native
An evening with React Native
React Native
Introduction to React Native & Rendering Charts / Graphs
React native: building native iOS apps with javascript
React + Redux for Web Developers
Getting Started with React Native (and should I use it at all?)
Introduction to react native
Creating books app with react native

What's hot (20)

PPTX
Isomorphic JavaScript – future of the web
PPTX
React JS Belgium Touch Base - React, Flux, React Native
PDF
Tech Talk on ReactJS
PPTX
React Native for ReactJS Devs
PPSX
React introduction
PPTX
Presentation1
PDF
Introduction to React Native
PDF
React native-meetup-talk
PPTX
React js Online Training
PDF
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
PPTX
Angle Forward with TypeScript
PPTX
React JS: A Secret Preview
PDF
Intro To React Native
PPTX
Single Page Applications: Your Browser is the OS!
PDF
Developing, building, testing and deploying react native apps
PDF
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
PDF
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
KEY
The Architect Way
PDF
Алексей Волков "Введение в React Native"
Isomorphic JavaScript – future of the web
React JS Belgium Touch Base - React, Flux, React Native
Tech Talk on ReactJS
React Native for ReactJS Devs
React introduction
Presentation1
Introduction to React Native
React native-meetup-talk
React js Online Training
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
Angle Forward with TypeScript
React JS: A Secret Preview
Intro To React Native
Single Page Applications: Your Browser is the OS!
Developing, building, testing and deploying react native apps
MidwestJS 2014 Reconciling ReactJS as a View Layer Replacement
Reconciling ReactJS as a View Layer Replacement (MidwestJS 2014)
The Architect Way
Алексей Волков "Введение в React Native"
Ad

Similar to Introduction to react native with redux (20)

PDF
React Native
PPTX
Presentation1
PDF
React Native +Redux + ES6 (Updated)
PPTX
Getting Started With React Native Presntation
PPTX
React Native Building Mobile Apps with React.pptx
PPTX
Introduction to react native @ TIC NUST
PPTX
Introduction to React Native
PPTX
ReactNative.pptx
PDF
React Js Simplified
PPTX
React native introduction (Mobile Warsaw)
PPTX
React vs React Native
PDF
React Native Components Building Blocks for Dynamic Apps.pdf
PDF
React js vs react native a comparative analysis
PPTX
React native
PPT
PPTX
Introduction to React Native
PDF
PPTX
React Native - Build Native Mobile App
PDF
How Can the Hermes Engine Help React Native Apps.
PDF
How Can the Hermes Engine Help React Native Apps.docx.pdf
React Native
Presentation1
React Native +Redux + ES6 (Updated)
Getting Started With React Native Presntation
React Native Building Mobile Apps with React.pptx
Introduction to react native @ TIC NUST
Introduction to React Native
ReactNative.pptx
React Js Simplified
React native introduction (Mobile Warsaw)
React vs React Native
React Native Components Building Blocks for Dynamic Apps.pdf
React js vs react native a comparative analysis
React native
Introduction to React Native
React Native - Build Native Mobile App
How Can the Hermes Engine Help React Native Apps.
How Can the Hermes Engine Help React Native Apps.docx.pdf
Ad

More from Mike Melusky (20)

PPTX
Container Orchestration for .NET Developers
PPTX
Containerize all the things!
PPTX
Building a Google Cloud Firestore API with dotnet core
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Effective .NET Core Unit Testing with SQLite and Dapper
PPTX
Reactive Web Development with Spring Boot 2
PPTX
Building xamarin.forms apps with prism and mvvm
PPTX
Xamarin.Forms Bootcamp
PPTX
Progressive Web Apps and React
PPTX
Into to Docker (Central PA Java User Group - 8/14/2017)
PPTX
An afternoon with angular 2
PPTX
An evening with Angular 2
PPTX
Securing your azure web app with asp.net core data protection
PPTX
Ember.js and .NET Integration
PPTX
Building Native “apps” with Visual Studio 2015
PPTX
Emberjs and ASP.NET
PPTX
Fun with lambda expressions
PPTX
An evening with querydsl
PPTX
Fun with lambda expressions
PPTX
Fun with windows services
Container Orchestration for .NET Developers
Containerize all the things!
Building a Google Cloud Firestore API with dotnet core
Effective .NET Core Unit Testing with SQLite and Dapper
Effective .NET Core Unit Testing with SQLite and Dapper
Reactive Web Development with Spring Boot 2
Building xamarin.forms apps with prism and mvvm
Xamarin.Forms Bootcamp
Progressive Web Apps and React
Into to Docker (Central PA Java User Group - 8/14/2017)
An afternoon with angular 2
An evening with Angular 2
Securing your azure web app with asp.net core data protection
Ember.js and .NET Integration
Building Native “apps” with Visual Studio 2015
Emberjs and ASP.NET
Fun with lambda expressions
An evening with querydsl
Fun with lambda expressions
Fun with windows services

Recently uploaded (20)

PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Cloud computing and distributed systems.
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPT
Teaching material agriculture food technology
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Transforming Manufacturing operations through Intelligent Integrations
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
KodekX | Application Modernization Development
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Cloud computing and distributed systems.
Understanding_Digital_Forensics_Presentation.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
cuic standard and advanced reporting.pdf
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Teaching material agriculture food technology
The Rise and Fall of 3GPP – Time for a Sabbatical?
Transforming Manufacturing operations through Intelligent Integrations
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
KodekX | Application Modernization Development
20250228 LYD VKU AI Blended-Learning.pptx

Introduction to react native with redux

  • 1. INTRODUCTIONTO REACT NATIVE WITH REDUX Michael Melusky - @mrjavascript Philly.NET – March 24, 2018
  • 2. Topics • Introduction to React: • Components • Props • State • React Native • Build a sample app! • Advanced React Native Concepts • Navigation • Redux Persist • Compare and contrast to other “Native” frameworks
  • 3. About Speaker • Michael Melusky • Software Developer atAudacious Inquiry (Baltimore, MD) • Faculty member at Penn State Harrisburg and Franklin and MarshallCollege • @mrjavascript (Twitter/GitHub) • @melusky (XBOX)
  • 4. Any prerequisites? • HTML5 • CSS3 • JavaScript (ES6/TypeScript) • Node / NPM • https://nodejs.org/en/download/ • Development IDE: • Atom (Github) • Visual Studio Code (Microsoft) • WebStorm (JetBrains)
  • 6. What is React? • JavaScript framework for building user interfaces • Maintained by Facebook • Based off of a Component model (Similar to Angular 2/4)
  • 7. React Components • Building blocks for React applications • Written in JSX: • Allows you to embed HTML tags inside of JavaScript
  • 8. React Components – Shopping List
  • 9. React Components • Written in ES6/JSX • Browsers understand plain vanilla JavaScript • Babel transpiles the ES6/JSX into vanilla JavaScript for the browsers • Source-to-source compiler
  • 10. React Components – Shopping Cart
  • 11. React Components – Shopping Cart
  • 13. Communication between Components • Two ways to communicate between React components: • Props • Allows arbitrary inputs to be passed as inputs to components • Used for parent child communication • State • state is used to store data used in the current page • A parent component’s state often becomes a child component’s props
  • 18. React Native • A framework for building mobile apps (iOS/Android) using JavaScript! • Uses the same component model React web apps use • Which “apps” are using React Native? • Facebook • Instagram • Airbnb • Skype (MicrosoftTeams) • Walmart • Yes Microsoft is using React Native actively!
  • 19. Let’s Build a React NativeApp!
  • 20. Let’s Build a React NativeApp!
  • 21. Let’s Build a React NativeApp!
  • 22. Let’s Build a React NativeApp! • ** DEMO **
  • 30. Community Solutions • For handling Navigation, Facebook recommends a pair of community modules: • react-navigation • react-native-navigation • https://github.com/wix/react-native-navigation
  • 32. React Navigation • A number of navigators can be used: • StackNavigator - Renders one screen at a time and provides transitions between screens.When a new screen is opened it is placed on top of the stack. • (in Xamarin, NavigationPage) • TabNavigator - Renders a tab bar that lets the user switch between several screens • (In Xamarin,TabbedPage) • DrawerNavigator - Provides a drawer that slides in from the left of the screen • (In Xamarin, MasterDetailPage)
  • 36. REDUX
  • 38. Redux • A number of frameworks exist for state management: • Redux • MobX • React actually ships with its own component state management (this.state) • Can be used with any framework (Ember, jQuery, Angular, et al.)
  • 39. Why Redux? • Redux is a predictable state container for JavaScript apps. • There are many states in an app that will change depending on time, user behavior, or a plethora of different reasons. • Thus, if we consider an app as the process to change its own state, the view a user sees is how the states are presented.
  • 40. How does Redux Work? • Redux can be broken down into the following: • store: manages the states. Mainly there is a dispatch method to dispatch an action. In a Redux app, you can obtain its states via store.getState() • action: a simple, plain JavaScript object. An action can also be considered as a command to change a state. • reducer: decides how to change a state after receiving an action, and thus can be considered the entrance of a state change. A reducer is comprised of functions, and it changes states by taking an action as an argument, in which it then returns a new state. • Is a pure function: • Doesn’t alter input data • Doesn’t depend on external state (database, DOM) and consistently produces the same output for same input • middleware: the middleman between a store.dispatch() and a reducer. Its purpose is to intercept an action that has been dispatched, and modify or even cancel the action before it reaches the reducer.
  • 43. Compare and Contrast Xamarin React Native Ionic Language C# JavaScript TypeScript Native Widgets yes yes no General ideas Staying close to native Functional approach: UI is a function of state Use web technologies for maximum portability
  • 44. Measuring Performance • JIT and AOT • JIT – Just inTime • Just-in-time compilation (JIT) is the process of compiling a bytecode or a source code into the native code at runtime. • Hence, a piece of code (bytecode or source code) is not interpreted at runtime every time it gets executed, but it’s only interpreted once at runtime, and every next time it is executed, a fast native code runs. • AOT – Ahead ofTime • Ahead-of-time compilation (AOT) is the same process performed before starting the application, at compile time
  • 45. AOT or JIT? • Both C# and JavaScript are not compiled into the native code of the target CPU. C# is compiled into some bytecode, and JavaScript is interpreted.Thus, the performance question arises • You might think AOT is always better than JIT, because you only need to compile once and not every time you start the program • But let’s remember that JavaScript is a dynamically typed language, and this is the reason why JIT can outperform AOT in JavaScript case
  • 46. Compare and Contrast (Continued)
  • 48. Additional Resources • https://react.christmas/ • ReactTutorial in “Advent Calendar” format • https://twitter.com/dan_abramov • Twitter of Redux creator • https://www.reddit.com/r/reactjs/ • Subreddit for React • https://github.com/fbsamples/f8app • F8 conference app, great React Native demo
  • 49. Thank you for coming • https://twitter.com/mrjavascript/ • https://github.com/mrjavascript