6
Most read
7
Most read
8
Most read
Intro to ReactJS
Varun Raj
Sr. Application Architect @ Skcript
varun@skcript.com @zathvarun
About Me
Library for building User Interfaces
V part of MVC ( Model View Controller )
Not a front end framework
What is React ?
And React is not a templating library
Why To Use React ?
Simple
Declarative
Build Reusable Components
React Uses JSX (JavaScript & XML)
Standard HTML - Accept all attributes
Little modifications like className instead of class
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">
Hello, world! I am a CommentBox.
</div>
);
}
});
Virtual DOM
React uses a concept called Virtual DOM
It’s Faster for re-rendering the entire component on every state change.
Virtual DOM uses diff algorithm.
Can rendered in server and synced with local client.
Three Important Terminologies
Components
States
Props
Components
Everything is a component in react
Created using React.createClass
Key functions for every components
getInitialState: function() {},
componentWillMount : function() {},
componentDidMount : function() {},
componentWillUnmount : function() {},
componentDidUnmount : function() {},
render : function() {}
Introduction to React JS for beginners
Props
Loaded as attributes for components
Used for unidirectional data flow
immutable or read only
var CommentBox = React.createClass({
render: function() {
return (
<div className="commentBox">{this.props.message}</div>
);
}
});
ReactDOM.render(<CommentBox message=”Say Hello”/>,document.getElementById('content'));
Defines states of a component.
Changes to the state causes re rendering of the entire component.
getInitialState() is used to set initial states of the component
setstate({state: value}) is used to update the state
States
Render Function
The Actual View Code is written here
States and Props both are read-only here
Returns JSX Elements
render: function() {
return (
<div className="commentBox">{this.props.message}</div>
);
}
Forms
Form elements are pointed or named with ref attribute
From values are extracted like this.refs.searchInput.value where
searchInput is the ref of the input element
Default value is set with help of defaultValue attribute.
Events
Cross Browser Events
CamelCase Event Handlers
onDragStart
onDrop
onMouseDown
onMouseEnter
onMouseLeave
onMouseMove
onMouseOut
onMouseOver
onMouseUp
onClick
onContextMenu
onDoubleClick
onDrag
onDragEnd
onDragEnter
onDragExit
onDragLeave
onDragOver
Component LifeCycle
TODO LIST EXAMPLE
var TodoList = React.createClass({
render: function() {
var createItem = function(item) {
return <li key={item.id}>{item.text}</li>;
};
return <ul>{this.props.items.map(createItem)}</ul>;
}
});
var TodoApp = React.createClass({
getInitialState: function() { return {items: [], text: ''};},
onChange: function(e) {
this.setState({text: e.target.value});
},
handleSubmit: function(e) {
e.preventDefault();
var nextItems = this.state.items.concat([{text: this.state.text, id: Date.now()}]);
var nextText = '';
this.setState({items: nextItems, text: nextText});
},
render: function() {
return (
<div>
<h3>TODO</h3>
<TodoList items={this.state.items} />
<form onSubmit={this.handleSubmit}>
<input onChange={this.onChange} value={this.state.text} />
<button>{'Add #' + (this.state.items.length + 1)}</button>
</form>
</div>
);
}
});
ReactDOM.render(<TodoApp />, mountNode);
Useful tools when developing in React
HTML to JSX Compiler
React Developer Tools for Chrome
React Developer Tools for Firefox
Sites built with React
Facebook
Whatsapp Web
netflix
BlankCursor
Instagram
Producthunt
messenger.com
Introduction to React JS for beginners
Thank You !
varun@skcript.com @zathvarun

More Related Content

PPTX
Introduction to React JS
PPTX
Introduction to react_js
PPTX
[Final] ReactJS presentation
PPTX
Introduction to React JS for beginners | Namespace IT
PDF
React JS - Introduction
PPTX
React JS - A quick introduction tutorial
PPTX
React workshop
PPTX
ReactJS presentation.pptx
Introduction to React JS
Introduction to react_js
[Final] ReactJS presentation
Introduction to React JS for beginners | Namespace IT
React JS - Introduction
React JS - A quick introduction tutorial
React workshop
ReactJS presentation.pptx

What's hot (20)

PDF
Understanding react hooks
PDF
An introduction to React.js
PPTX
Reactjs
PDF
ReactJS presentation
PPTX
React js programming concept
PPTX
React js - The Core Concepts
PPTX
reactJS
PPTX
React state
PPTX
React + Redux Introduction
PDF
Basics of React Hooks.pptx.pdf
PPTX
PPT
React js
PDF
An Introduction to Redux
PPTX
Intro to React
PPTX
Understanding react hooks
PDF
React and redux
PDF
Introduction to React JS
PPTX
React hooks
ODP
Introduction to ReactJS
Understanding react hooks
An introduction to React.js
Reactjs
ReactJS presentation
React js programming concept
React js - The Core Concepts
reactJS
React state
React + Redux Introduction
Basics of React Hooks.pptx.pdf
React js
An Introduction to Redux
Intro to React
Understanding react hooks
React and redux
Introduction to React JS
React hooks
Introduction to ReactJS
Ad

Similar to Introduction to React JS for beginners (20)

PPTX
PPTX
React & Redux for noobs
PDF
Reactивная тяга
PPTX
Intro react js
PPTX
React/Redux
PPTX
ReactJS (1)
PPTX
React - Start learning today
PDF
Manage the Flux of your Web Application: Let's Redux
PPTX
React outbox
PPTX
Combining Angular and React Together
PDF
React lecture
PPTX
Dyanaimcs of business and economics unit 2
PDF
React for Re-use: Creating UI Components with Confluence Connect
PPTX
Getting Started With ReactJS
PPTX
react-slides.pptx
PPTX
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
PPTX
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
PDF
React native
PPTX
Introduction to React and MobX
PDF
Fundamental concepts of react js
React & Redux for noobs
Reactивная тяга
Intro react js
React/Redux
ReactJS (1)
React - Start learning today
Manage the Flux of your Web Application: Let's Redux
React outbox
Combining Angular and React Together
React lecture
Dyanaimcs of business and economics unit 2
React for Re-use: Creating UI Components with Confluence Connect
Getting Started With ReactJS
react-slides.pptx
react-slidlkjfl;kj;dlkjopidfjhopijgpoerjpofjiwoepifjopweifjepoies.pptx
TRAINING pptt efwoiefo weoifjoiewjfoifjow.pptx
React native
Introduction to React and MobX
Fundamental concepts of react js
Ad

Recently uploaded (20)

PDF
Recent Trends in Network Security - 2025
PDF
ITEC 1010 - Networks and Cloud Computing
PDF
CBCN cam bien cong nghiep bach khoa da năng
PPTX
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
PPT
Basics Of Pump types, Details, and working principles.
PDF
Software defined netwoks is useful to learn NFV and virtual Lans
PDF
AI agent, robotics based Smart Construction 2025
PDF
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
PPTX
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
PDF
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
PPTX
non conventional energy resorses material unit-1
PDF
ANTIOXIDANT AND ANTIMICROBIAL ACTIVITIES OF ALGERIAN POPULUS NIGRA L. BUDS EX...
PDF
Application of smart robotics in the supply chain
PPTX
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
PPTX
ARCHITECTURE AND PROGRAMMING OF EMBEDDED SYSTEMS
PPTX
L1111-Important Microbial Mechanisms.pptx
PPTX
Unit I - Mechatronics.pptx presentation
PDF
PhD defense presentation in field of Computer Science
PPTX
Software-Development-Life-Cycle-SDLC.pptx
PPT
Unit - I.lathemachnespct=ificationsand ppt
Recent Trends in Network Security - 2025
ITEC 1010 - Networks and Cloud Computing
CBCN cam bien cong nghiep bach khoa da năng
Unit IILATHEACCESSORSANDATTACHMENTS.pptx
Basics Of Pump types, Details, and working principles.
Software defined netwoks is useful to learn NFV and virtual Lans
AI agent, robotics based Smart Construction 2025
LS-6-Digital-Literacy (1) K12 CURRICULUM .pdf
1. Effective HSEW Induction Training - EMCO 2024, O&M.pptx
MACCAFERRY GUIA GAVIONES TERRAPLENES EN ESPAÑOL
non conventional energy resorses material unit-1
ANTIOXIDANT AND ANTIMICROBIAL ACTIVITIES OF ALGERIAN POPULUS NIGRA L. BUDS EX...
Application of smart robotics in the supply chain
240409 Data Center Training Programs by Uptime Institute (Drafting).pptx
ARCHITECTURE AND PROGRAMMING OF EMBEDDED SYSTEMS
L1111-Important Microbial Mechanisms.pptx
Unit I - Mechatronics.pptx presentation
PhD defense presentation in field of Computer Science
Software-Development-Life-Cycle-SDLC.pptx
Unit - I.lathemachnespct=ificationsand ppt

Introduction to React JS for beginners

  • 2. Varun Raj Sr. Application Architect @ Skcript [email protected] @zathvarun About Me
  • 3. Library for building User Interfaces V part of MVC ( Model View Controller ) Not a front end framework What is React ?
  • 4. And React is not a templating library
  • 5. Why To Use React ? Simple Declarative Build Reusable Components
  • 6. React Uses JSX (JavaScript & XML) Standard HTML - Accept all attributes Little modifications like className instead of class var CommentBox = React.createClass({ render: function() { return ( <div className="commentBox"> Hello, world! I am a CommentBox. </div> ); } });
  • 7. Virtual DOM React uses a concept called Virtual DOM It’s Faster for re-rendering the entire component on every state change. Virtual DOM uses diff algorithm. Can rendered in server and synced with local client.
  • 9. Components Everything is a component in react Created using React.createClass Key functions for every components getInitialState: function() {}, componentWillMount : function() {}, componentDidMount : function() {}, componentWillUnmount : function() {}, componentDidUnmount : function() {}, render : function() {}
  • 11. Props Loaded as attributes for components Used for unidirectional data flow immutable or read only var CommentBox = React.createClass({ render: function() { return ( <div className="commentBox">{this.props.message}</div> ); } }); ReactDOM.render(<CommentBox message=”Say Hello”/>,document.getElementById('content'));
  • 12. Defines states of a component. Changes to the state causes re rendering of the entire component. getInitialState() is used to set initial states of the component setstate({state: value}) is used to update the state States
  • 13. Render Function The Actual View Code is written here States and Props both are read-only here Returns JSX Elements render: function() { return ( <div className="commentBox">{this.props.message}</div> ); }
  • 14. Forms Form elements are pointed or named with ref attribute From values are extracted like this.refs.searchInput.value where searchInput is the ref of the input element Default value is set with help of defaultValue attribute.
  • 15. Events Cross Browser Events CamelCase Event Handlers onDragStart onDrop onMouseDown onMouseEnter onMouseLeave onMouseMove onMouseOut onMouseOver onMouseUp onClick onContextMenu onDoubleClick onDrag onDragEnd onDragEnter onDragExit onDragLeave onDragOver
  • 17. TODO LIST EXAMPLE var TodoList = React.createClass({ render: function() { var createItem = function(item) { return <li key={item.id}>{item.text}</li>; }; return <ul>{this.props.items.map(createItem)}</ul>; } }); var TodoApp = React.createClass({ getInitialState: function() { return {items: [], text: ''};}, onChange: function(e) { this.setState({text: e.target.value}); }, handleSubmit: function(e) { e.preventDefault(); var nextItems = this.state.items.concat([{text: this.state.text, id: Date.now()}]); var nextText = ''; this.setState({items: nextItems, text: nextText}); }, render: function() { return ( <div> <h3>TODO</h3> <TodoList items={this.state.items} /> <form onSubmit={this.handleSubmit}> <input onChange={this.onChange} value={this.state.text} /> <button>{'Add #' + (this.state.items.length + 1)}</button> </form> </div> ); } }); ReactDOM.render(<TodoApp />, mountNode);
  • 18. Useful tools when developing in React HTML to JSX Compiler React Developer Tools for Chrome React Developer Tools for Firefox
  • 19. Sites built with React Facebook Whatsapp Web netflix BlankCursor Instagram Producthunt messenger.com

Editor's Notes

  • #4: Can also be used with angularjs React has routes
  • #7: Written inside render fucntion Add tags must be closed properly purely xml has inline event lisenters
  • #8: Not similar to Shadow DOM can be seen in normal dom but with special attributes like react-id
  • #9: Also there are few other things like Mixins refs
  • #10: Can be nested Mounted unmounted dynamically They as like partials but in different manner
  • #11: Completly react Whatsapp Web
  • #12: Read Only Attributes Sent from the render call can also set default props from component with special function call getDefaultProps Usually props to be chaged are stored to statees and then the state is modified
  • #13: Initialied based on the some condition or from props states controls the modification changes reflects in rerendering
  • #18: Example of todo list application from the official docs