SlideShare une entreprise Scribd logo
1  sur  24
GETTING STARTED
WITH REACTJS
VIEW
AGENDA
Installing ReactJS ReactJS event handling ReactJS lifecycle example
Configuring ReactJS Useful non-DOM attributes Stateful custom component
Using ReactJS ReactJS component
lifecycle
Precompiled JSX for
production
What is JSX ReactJS initialization
phase
JSX file watcher
Custom components with
JSX
ReactJS lifetime phase Developing a digital clock
using ReactJS
ReactJS inline style ReactJS teardown phase Debugging ReactJS
OUT OF SCOPE
Comparing ReactJS with Other framework
Building React Routing
Isomorphic React
React Native
Synthetic Event
React ES6 implementation
WHO AM I?
 Sandeep Kumar Patel
 Intuit PTG Developer
 Blog: www.tutorialsavvy.com
REQUIRED SOFTWARE
Code Editor (WebStorm)
NPM (Node Package Manager)
GIT (Code Repository)
REACTJS INSTALLATION
Create a project Directory
Change the Current Working Directory
Run npm init for creating package.json
Run npm install react --save
Verify node_modules directory
CONFIGURING REACTJS
LOCAL
<script src="node_modules/react/react.js"></script>
<script src="node_modules/react/JSXTransformer.js"> </script>
CDN
<script src="https://fb.me/react-0.13.3.min.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
WHAT IS JSX ?
JavaScript syntax extension
HTML like syntax
JSX Transformer
In browser compilation
CUSTOM COMPONENTS WITH JSX
<script type="text/jsx">
var HelloMessage = React.createClass({
render: function() {
return ( <h1 className="headerStyle">
Hello ReactJS
</h1>
); } });
React.render(<HelloMessage/>, document.body);
</script>
REACTJS INLINE STYLE
Key-value pair
var styleObject={
styleAttribute: "styleValue",
};
styleAttribute : camel case
styleValue: wrapped in double quotes
Example
REACTJS EVENT HANDLING
Similar to HTML DOM events
Difference in naming handlers
Handlers are camel case
onclick becomes onClick
Example
USEFUL NON-DOM ATTRIBUTES
key:
This is an optional attribute can be used for uniquely identify each component in the page.
ref:
This is an optional attribute that can be used to access the child element from outside of render()
method.
dangerouslySetInnerHTML:
This attribute can be used inside JSX element to set HTML content inside the component.
Example
REACTJS COMPONENT LIFECYCLE
REACTJS INITIALIZATION PHASE
element is created for the 1st time.
has slight changes during lifetime
REACTJS LIFETIME PHASE
the phase when element lives.
changes its states and properties
REACTJS TEARDOWN PHASE
the phase when element finishes its execution
clean-up takes place.
REACTJS LIFECYCLE EXAMPLE
Let’s checkout an simple React Component <Welcome>
To determine the order of execution of these lifecycle methods
Example
STATEFUL CUSTOM COMPONENT
To refer the component state : this.states
To change the component state : this.setState(<object>)
Object: {key:value}
Example
PRECOMPILED JSX FOR PRODUCTION
Remove in browser JSX transformer
React-tools
npm install -g react-tools
Example
JSX FILE WATCHER
Comes with react-tools
jsx --watch dev production
DEVELOPING A DIGITAL CLOCK USING REACTJS
Develop a digital Clock in React Component to Hour minute and seconds
DEBUGGING REACTJS
React Chrome Debugging tool
https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
ADD VIRTUAL DOM
Virtual DOM is Simple and Fast
Batch Execution updates
THANK YOU
CONTACT ME:
Email: sandeepkumar_patel@intuit.com
Gmail: sandeeppateltech@gmail.com
Book: http://techbus.safaribooksonline.com/book/web-development/9781784393649

Contenu connexe

Tendances

Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingBinary Studio
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and ReduxGlib Kechyn
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSHoang Long
 
Up and Running with ReactJS
Up and Running with ReactJSUp and Running with ReactJS
Up and Running with ReactJSLoc Nguyen
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux jsCitrix
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with ReduxVedran Blaženka
 
React for Dummies
React for DummiesReact for Dummies
React for DummiesMitch Chen
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJSAll Things Open
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with ReactjsThinh VoXuan
 
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 NativeEric Deng
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developerEugene Zharkov
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJSTu Hoang
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.jsEmanuele DelBono
 

Tendances (20)

React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
React / Redux Architectures
React / Redux ArchitecturesReact / Redux Architectures
React / Redux Architectures
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
 
React & redux
React & reduxReact & redux
React & redux
 
React JS and Redux
React JS and ReduxReact JS and Redux
React JS and Redux
 
React js
React jsReact js
React js
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Up and Running with ReactJS
Up and Running with ReactJSUp and Running with ReactJS
Up and Running with ReactJS
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
React for Dummies
React for DummiesReact for Dummies
React for Dummies
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
Starting with Reactjs
Starting with ReactjsStarting with Reactjs
Starting with Reactjs
 
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
 
Switch to React.js from AngularJS developer
Switch to React.js from AngularJS developerSwitch to React.js from AngularJS developer
Switch to React.js from AngularJS developer
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
An introduction to React.js
An introduction to React.jsAn introduction to React.js
An introduction to React.js
 
React js
React jsReact js
React js
 
Workshop React.js
Workshop React.jsWorkshop React.js
Workshop React.js
 

Similaire à Getting Started With ReactJS

React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners Varun Raj
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react jsdhanushkacnd
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 
React, Flux and more (p1)
React, Flux and more (p1)React, Flux and more (p1)
React, Flux and more (p1)tuanpa206
 
Combining Angular and React Together
Combining Angular and React TogetherCombining Angular and React Together
Combining Angular and React TogetherSebastian Pederiva
 
A React Journey
A React JourneyA React Journey
A React JourneyLinkMe Srl
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryjanet736113
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJSLinkMe Srl
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react jsStephieJohn
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react reduxRajesh Kumar
 

Similaire à Getting Started With ReactJS (20)

React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
Build web apps with react js
Build web apps with react jsBuild web apps with react js
Build web apps with react js
 
Intro react js
Intro react jsIntro react js
Intro react js
 
react-slides.pptx
react-slides.pptxreact-slides.pptx
react-slides.pptx
 
ReactJS (1)
ReactJS (1)ReactJS (1)
ReactJS (1)
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 
React, Flux and more (p1)
React, Flux and more (p1)React, Flux and more (p1)
React, Flux and more (p1)
 
Combining Angular and React Together
Combining Angular and React TogetherCombining Angular and React Together
Combining Angular and React Together
 
ReactJS
ReactJSReactJS
ReactJS
 
A React Journey
A React JourneyA React Journey
A React Journey
 
react-slides.pdf
react-slides.pdfreact-slides.pdf
react-slides.pdf
 
react-slides.pdf gives information about react library
react-slides.pdf gives information about react libraryreact-slides.pdf gives information about react library
react-slides.pdf gives information about react library
 
Corso su ReactJS
Corso su ReactJSCorso su ReactJS
Corso su ReactJS
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
Reactjs
ReactjsReactjs
Reactjs
 
Spfx with react redux
Spfx with react reduxSpfx with react redux
Spfx with react redux
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 

Getting Started With ReactJS

  • 2. AGENDA Installing ReactJS ReactJS event handling ReactJS lifecycle example Configuring ReactJS Useful non-DOM attributes Stateful custom component Using ReactJS ReactJS component lifecycle Precompiled JSX for production What is JSX ReactJS initialization phase JSX file watcher Custom components with JSX ReactJS lifetime phase Developing a digital clock using ReactJS ReactJS inline style ReactJS teardown phase Debugging ReactJS
  • 3. OUT OF SCOPE Comparing ReactJS with Other framework Building React Routing Isomorphic React React Native Synthetic Event React ES6 implementation
  • 4. WHO AM I?  Sandeep Kumar Patel  Intuit PTG Developer  Blog: www.tutorialsavvy.com
  • 5. REQUIRED SOFTWARE Code Editor (WebStorm) NPM (Node Package Manager) GIT (Code Repository)
  • 6. REACTJS INSTALLATION Create a project Directory Change the Current Working Directory Run npm init for creating package.json Run npm install react --save Verify node_modules directory
  • 7. CONFIGURING REACTJS LOCAL <script src="node_modules/react/react.js"></script> <script src="node_modules/react/JSXTransformer.js"> </script> CDN <script src="https://fb.me/react-0.13.3.min.js"></script> <script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
  • 8. WHAT IS JSX ? JavaScript syntax extension HTML like syntax JSX Transformer In browser compilation
  • 9. CUSTOM COMPONENTS WITH JSX <script type="text/jsx"> var HelloMessage = React.createClass({ render: function() { return ( <h1 className="headerStyle"> Hello ReactJS </h1> ); } }); React.render(<HelloMessage/>, document.body); </script>
  • 10. REACTJS INLINE STYLE Key-value pair var styleObject={ styleAttribute: "styleValue", }; styleAttribute : camel case styleValue: wrapped in double quotes Example
  • 11. REACTJS EVENT HANDLING Similar to HTML DOM events Difference in naming handlers Handlers are camel case onclick becomes onClick Example
  • 12. USEFUL NON-DOM ATTRIBUTES key: This is an optional attribute can be used for uniquely identify each component in the page. ref: This is an optional attribute that can be used to access the child element from outside of render() method. dangerouslySetInnerHTML: This attribute can be used inside JSX element to set HTML content inside the component. Example
  • 14. REACTJS INITIALIZATION PHASE element is created for the 1st time. has slight changes during lifetime
  • 15. REACTJS LIFETIME PHASE the phase when element lives. changes its states and properties
  • 16. REACTJS TEARDOWN PHASE the phase when element finishes its execution clean-up takes place.
  • 17. REACTJS LIFECYCLE EXAMPLE Let’s checkout an simple React Component <Welcome> To determine the order of execution of these lifecycle methods Example
  • 18. STATEFUL CUSTOM COMPONENT To refer the component state : this.states To change the component state : this.setState(<object>) Object: {key:value} Example
  • 19. PRECOMPILED JSX FOR PRODUCTION Remove in browser JSX transformer React-tools npm install -g react-tools Example
  • 20. JSX FILE WATCHER Comes with react-tools jsx --watch dev production
  • 21. DEVELOPING A DIGITAL CLOCK USING REACTJS Develop a digital Clock in React Component to Hour minute and seconds
  • 22. DEBUGGING REACTJS React Chrome Debugging tool https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi
  • 23. ADD VIRTUAL DOM Virtual DOM is Simple and Fast Batch Execution updates
  • 24. THANK YOU CONTACT ME: Email: sandeepkumar_patel@intuit.com Gmail: sandeeppateltech@gmail.com Book: http://techbus.safaribooksonline.com/book/web-development/9781784393649