SlideShare a Scribd company logo
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

More Related Content

PPTX
ReactJs presentation
PDF
Intro to ReactJS
PPTX
ReactJS for Beginners
PPTX
A Brief Introduction to React.js
PPTX
Better web apps with React and Redux
PDF
React.js in real world apps.
PPTX
React + Redux Introduction
PDF
React.js and Redux overview
ReactJs presentation
Intro to ReactJS
ReactJS for Beginners
A Brief Introduction to React.js
Better web apps with React and Redux
React.js in real world apps.
React + Redux Introduction
React.js and Redux overview

What's hot (20)

PDF
React JS - Introduction
PPTX
React / Redux Architectures
PPTX
Academy PRO: React JS. Redux & Tooling
PPTX
React & redux
PDF
React JS and Redux
PPT
React js
PDF
Introduction to ReactJS
PPTX
Up and Running with ReactJS
PPTX
Getting started with Redux js
PDF
React state managmenet with Redux
PDF
React for Dummies
PDF
An Introduction to ReactJS
PPT
Starting with Reactjs
PPTX
20180518 QNAP Seminar - Introduction to React Native
PDF
Switch to React.js from AngularJS developer
PDF
Introduction to ReactJS
PDF
An introduction to React.js
PPTX
PDF
Workshop React.js
React JS - Introduction
React / Redux Architectures
Academy PRO: React JS. Redux & Tooling
React & redux
React JS and Redux
React js
Introduction to ReactJS
Up and Running with ReactJS
Getting started with Redux js
React state managmenet with Redux
React for Dummies
An Introduction to ReactJS
Starting with Reactjs
20180518 QNAP Seminar - Introduction to React Native
Switch to React.js from AngularJS developer
Introduction to ReactJS
An introduction to React.js
Workshop React.js
Ad

Similar to Getting Started With ReactJS (20)

PPTX
React - Start learning today
PPTX
Dyanaimcs of business and economics unit 2
PPTX
Introduction to React JS for beginners
PDF
Introduction Web Development using ReactJS
PPTX
ReactJS presentation.pptx
PPTX
Build web apps with react js
PPTX
Intro react js
PPTX
react-slides.pptx
PPTX
ReactJS (1)
PDF
Introduction to react
PPTX
React, Flux and more (p1)
PPTX
Combining Angular and React Together
PPTX
PDF
A React Journey
PPTX
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
PDF
react-slides.pdf
PDF
react-slides.pdf gives information about react library
PPTX
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
PPTX
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
PDF
Corso su ReactJS
React - Start learning today
Dyanaimcs of business and economics unit 2
Introduction to React JS for beginners
Introduction Web Development using ReactJS
ReactJS presentation.pptx
Build web apps with react js
Intro react js
react-slides.pptx
ReactJS (1)
Introduction to react
React, Flux and more (p1)
Combining Angular and React Together
A React Journey
unit 2 React js.pptxdgdgdgdgdgdgdgdgdsgdgdg
react-slides.pdf
react-slides.pdf gives information about react library
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
Corso su ReactJS
Ad

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