SlideShare a Scribd company logo
1 of 17
Download to read offline
React
What is React?
React is a JS library for rendering web pages.
That’s it.
The closest equivalent is angular with only directives
without the other features such as services,
controllers etc.
So why use it?
React is fast
Development best practices
React native
Server rendering.
Easy to grasp
Huge ecosystem
The React way - 4 principles of
developing react applications
1. Break the UI to components
2. Keep unidirectional data ow.
3. Identify the UI state.
4. Dispatch actions to change the state.
Break to little components
JSX
JSX is a syntactic sugar for function calls and object
construction
Instead of this:
React.createElement(
a,
{href:"spectory.com"},
'Spectory website’'
)
We can write:
<a href=”spectory.com”>Spectory website</a>
JSX
It is very similar to HTML, and it lets us integrate JS
code inside with curly braces:
class HelloPage extends Component {
render() {
let userName = 'amitai';
return (
<div>
<h1>Hello, {userName}, today is
{(new Date()).toDateString()}
</h1>
</div>
);
}
}
Children in JSX
Children is a unique prop in react
Created automatically when the component has
child elements.
Lets the parent component change the state or the
context of its children
Reminds ng-transclude in angular
Dumb and smart components
Smart Dumb
Inherit react
component
simple function
Describe how things
work
Describe how things look
Provide no DOM
markup or styles
Have no app dependencies
Provide data, do
data fetching
Receive only props,
providing data and callbacks
Call redux actions Rarely have own state
The default type of the component will be “dumb”
unless there is a need to upgrade it.
Redux
Redux is a set of libraries that simpli ed Flux.
Actions - action is a function that the application
uses to send data to the store.
Reducers - The reducers takes the data from the
action and inserts it into the state.
Store - the store has few responsibilities:
- Holds the state of the application, and expose it.
- Dispatches actions.
- Subscribes listeners on state changes events.
Redux data ow
Redux rules:
The reducer is a pure function that receives an
action and a state and returns new state.
Any action has case that manipulate the state.
The state is immutable
De ne "default" that will return the state.
Use default parameter in order to init our state.
The application state structure
It should be designed to serve the application
functionality
Before you add object to the state, stop, and think.
Keep it small and simple as possible.
You can manipulate this state before transferring
it to the props
Do not keep duplications or redundant data.
Treat it like you treat the database tables
Redux state vs local state
As a rule we do not want to use setState
The only exceptions are when the state is local and
is not related to the application
Debugging tools:
React Developer Tools
View the component ands it children.
View the state and props of the component.
View the component’s events.
Redux DevTools:
A must have for developing in redux
View actions
View the application state
Conclusion
React is the most popular framework right now.
It’s easy to learn and master.
IMO every web developer should learn it because
it is here to stay.
It is back by a large company that pushes it and
improve it all the time
It is expanding to supportany type of UX.
It helps the developer to write better software
and become more professional.
References
https://facebook.github.io/react/
http://redux.js.org/
https://www.youtube.com/watch?
v=5oiXG9f6GO0&index=1&list=PLuNEz8XtB51K-
x3bwCC9uNM_cxXaiCcRY - Rem Zolotykh
https://app.pluralsight.com/library/courses/react-
redux-react-router-es6/ - Cory House

More Related Content

What's hot

What's hot (20)

React js
React jsReact js
React js
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
State management in react applications (Statecharts)
State management in react applications (Statecharts)State management in react applications (Statecharts)
State management in react applications (Statecharts)
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
Workshop React.js
Workshop React.jsWorkshop React.js
Workshop React.js
 
React hooks
React hooksReact hooks
React hooks
 
React-JS Component Life-cycle Methods
React-JS Component Life-cycle MethodsReact-JS Component Life-cycle Methods
React-JS Component Life-cycle Methods
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Better web apps with React and Redux
Better web apps with React and ReduxBetter web apps with React and Redux
Better web apps with React and Redux
 
React.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOMReact.js - The Dawn of Virtual DOM
React.js - The Dawn of Virtual DOM
 
ReactJS
ReactJSReactJS
ReactJS
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
Its time to React.js
Its time to React.jsIts time to React.js
Its time to React.js
 
React Hooks
React HooksReact Hooks
React Hooks
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 

Similar to React

Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
SHAIKIRFAN715544
 

Similar to React (20)

React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥React + Redux + TypeScript === ♥
React + Redux + TypeScript === ♥
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
React JS Interview Question & Answer
React JS Interview Question & AnswerReact JS Interview Question & Answer
React JS Interview Question & Answer
 
an Introduction to Redux
an Introduction to Reduxan Introduction to Redux
an Introduction to Redux
 
REACTJS.pdf
REACTJS.pdfREACTJS.pdf
REACTJS.pdf
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
 
React gsg presentation with ryan jung &amp; elias malik
React   gsg presentation with ryan jung &amp; elias malikReact   gsg presentation with ryan jung &amp; elias malik
React gsg presentation with ryan jung &amp; elias malik
 
Getting started with react &amp; redux
Getting started with react &amp; reduxGetting started with react &amp; redux
Getting started with react &amp; redux
 
Reducers+flux=redux
Reducers+flux=reduxReducers+flux=redux
Reducers+flux=redux
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
ReactJs
ReactJsReactJs
ReactJs
 
React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
 
Introduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace ITIntroduction to React JS for beginners | Namespace IT
Introduction to React JS for beginners | Namespace IT
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 
Copy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdfCopy of React_JS_Notes.pdf
Copy of React_JS_Notes.pdf
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS Learn Stateful and Stateless components in ReactJS
Learn Stateful and Stateless components in ReactJS
 

Recently uploaded

+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Recently uploaded (20)

MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 

React

  • 2. What is React? React is a JS library for rendering web pages. That’s it. The closest equivalent is angular with only directives without the other features such as services, controllers etc.
  • 3. So why use it? React is fast Development best practices React native Server rendering. Easy to grasp Huge ecosystem
  • 4. The React way - 4 principles of developing react applications 1. Break the UI to components 2. Keep unidirectional data ow. 3. Identify the UI state. 4. Dispatch actions to change the state.
  • 5. Break to little components
  • 6. JSX JSX is a syntactic sugar for function calls and object construction Instead of this: React.createElement( a, {href:"spectory.com"}, 'Spectory website’' ) We can write: <a href=”spectory.com”>Spectory website</a>
  • 7. JSX It is very similar to HTML, and it lets us integrate JS code inside with curly braces: class HelloPage extends Component { render() { let userName = 'amitai'; return ( <div> <h1>Hello, {userName}, today is {(new Date()).toDateString()} </h1> </div> ); } }
  • 8. Children in JSX Children is a unique prop in react Created automatically when the component has child elements. Lets the parent component change the state or the context of its children Reminds ng-transclude in angular
  • 9. Dumb and smart components Smart Dumb Inherit react component simple function Describe how things work Describe how things look Provide no DOM markup or styles Have no app dependencies Provide data, do data fetching Receive only props, providing data and callbacks Call redux actions Rarely have own state The default type of the component will be “dumb” unless there is a need to upgrade it.
  • 10. Redux Redux is a set of libraries that simpli ed Flux. Actions - action is a function that the application uses to send data to the store. Reducers - The reducers takes the data from the action and inserts it into the state. Store - the store has few responsibilities: - Holds the state of the application, and expose it. - Dispatches actions. - Subscribes listeners on state changes events.
  • 12. Redux rules: The reducer is a pure function that receives an action and a state and returns new state. Any action has case that manipulate the state. The state is immutable De ne "default" that will return the state. Use default parameter in order to init our state.
  • 13. The application state structure It should be designed to serve the application functionality Before you add object to the state, stop, and think. Keep it small and simple as possible. You can manipulate this state before transferring it to the props Do not keep duplications or redundant data. Treat it like you treat the database tables
  • 14. Redux state vs local state As a rule we do not want to use setState The only exceptions are when the state is local and is not related to the application
  • 15. Debugging tools: React Developer Tools View the component ands it children. View the state and props of the component. View the component’s events. Redux DevTools: A must have for developing in redux View actions View the application state
  • 16. Conclusion React is the most popular framework right now. It’s easy to learn and master. IMO every web developer should learn it because it is here to stay. It is back by a large company that pushes it and improve it all the time It is expanding to supportany type of UX. It helps the developer to write better software and become more professional.