SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Downloaden Sie, um offline zu lesen
React JS
Introduction to React
What is React?
React is a declarative, efficient, and flexible
JavaScript library for building user interfaces.
2
http://coenraets.org/present/react/#6 3
http://coenraets.org/present/react/#7
4
Build components, not templates
● UI Components are the cohesive units
● UI description and UI logic
● Full power of JavaScript to express UI
5
React challenges established best practices
in traditional MVC framework
React can also render on the server using Node, and it can power native apps
using React Native.
React implements one-way reactive data flow which reduces boilerplate and is
easier to reason about than traditional data binding.
6
React Features
7
1. JSX
JSX is JavaScript syntax extension. It isn't necessary to use JSX in
React development, but it is recommended.
8
2. Components
React is all about components. You need to think of everything as a
component. This will help you to maintain the code when working on
larger scale projects.
9
3. Unidirectional data flow and Flux
React implements one way data flow which makes it easy to reason
about your app. Flux is a pattern that helps keeping your data
unidirectional
10
4. License
React is licensed under the Facebook Inc. Documentation is licensed
under CC BY 4.0.
11
React Advantages
● React uses virtual DOM which is JavaScript object. This will
improve apps performance since JavaScript virtual DOM is faster
than the regular DOM.
● React can be used on client and server side.
● Component and Data patterns improve readability which helps to
maintain larger apps.
● React can be used with other frameworks
12
React Limitations
● React only covers view layer of the app so you still need to choose
other technologies to get a complete tooling set for development.
● React is using inline templating and JSX. This can seem awkward
to some developers.
13
Environment Setup
14
While React can be used without a build pipeline, it is
recommend to use it up to be more productive.
A modern build pipeline typically consists of:
1. Package manager - Yarn or npm.
It lets you take advantage of a vast ecosystem of third-party
packages, and easily install or update them.
2. Bundler - webpack or Browserify.
It lets you write modular code and bundle it together into small
packages to optimize load time.
3. Compiler - Babel.
It lets you write modern JavaScript code that still works in older
browsers. 15
Using a CDN
<script src="https://unpkg.com/react@15/dist/react.min.js"></script>
<script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script>
16
create-react-app
● Create React apps with no build configuration.
npm install -g create-react-app
create-react-app my-app
cd my-app/
npm start
17
Create React App is the best way to start building a new React single page
application.
It sets up your development environment so that you can use the latest
JavaScript features, provides a nice developer experience, and optimizes your
app for production.
Create React App doesn't handle backend logic or databases; it just creates a
frontend build pipeline, so you can use it with any backend you want.
It uses webpack, Babel and ESLint under the hood, but configures them for you.
18
Hello World!
ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
19
React uses JSX for templating instead of regular JavaScript. It is not necessary
to use it, but there are some pros that comes with it.
● JSX is faster because it performs optimization while compiling code to
JavaScript.
● It is also type-safe and most of the errors can be caught during
compilation.
● JSX makes it easier and faster to write templates if you are familiar with
HTML.
20
1. Nested Elements
class App extends React.Component {
render() {
return (
<div>
<h1>Header</h1>
<h2>Content</h2>
<p>This is the content!!!</p>
</div>
);
}
} 21
2. JavaScript Expressions
class App extends React.Component {
render() {
return (
<div>
<h1>{1+1}</h1>
</div>
);
}
}
22
3. Styling
class App extends React.Component {
render() {
var myStyle = {
fontSize: 100,
color: '#FF0000'
}
return (
<div>
<h1 style = {myStyle}>Header</h1>
</div>
);
}
}
23
Components & Props
Components let you split the UI into independent, reusable pieces, and
think about each piece in isolation.
They accept arbitrary inputs (called "props") and return React elements
describing what should appear on the screen.
24
class Welcome extends React.Component
{
render() {
return <h1>Hello,
{this.props.name}</h1>;
}
}
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
With ES6Javascript function
25
But Props are Read-Only!
All React components must act like pure functions with
respect to their props.
Components can be reused
26
State allows React components to change their output over
time in response to user actions, network responses, and
anything else, without violating this rule.
State
27
class App extends React.Component {
constructor(props) {
super(props);
this.state = {
header: "Header from state...",
"content": "Content from state..."
}
}
render() {
return (
<div>
<h1>{this.state.header}</h1>
<h2>{this.state.content}</h2>
</div>
);
}
}
export default App;
State is the place where the data
comes from.
Always try to make your state as
simple as possible and minimize
number of stateful components.
If you have, for example, ten
components that need data from
the state, you should create one
container component that will keep
the state for all of them.
28
1. Components
2. Backend
3. Maintainable code
4. Learning curve
Thinking in React
29
● React is a library for building composable user interfaces.
● It encourages the creation of reusable UI components which
present data that changes over time.
● Lots of people use React as the V in MVC.
● React abstracts away the DOM from you, giving a simpler
programming model and better performance.
● React can also render on the server using Node, and it can power
native apps using React Native.
● Implements one-way reactive data flow which reduces boilerplate
and is easier to reason about than traditional data binding.
Summary
30
Thank You!
31

Weitere ähnliche Inhalte

Was ist angesagt? (20)

React JS - Introduction
React JS - IntroductionReact JS - Introduction
React JS - Introduction
 
React js for beginners
React js for beginnersReact js for beginners
React js for beginners
 
ReactJS presentation
ReactJS presentationReactJS presentation
ReactJS presentation
 
React workshop presentation
React workshop presentationReact workshop presentation
React workshop presentation
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Introduction to react_js
Introduction to react_jsIntroduction to react_js
Introduction to react_js
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
React workshop
React workshopReact workshop
React workshop
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
React JS part 1
React JS part 1React JS part 1
React JS part 1
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
Introduction à React
Introduction à ReactIntroduction à React
Introduction à React
 
Introduction à React JS
Introduction à React JSIntroduction à React JS
Introduction à 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
 
React + Redux Introduction
React + Redux IntroductionReact + Redux Introduction
React + Redux Introduction
 
ReactJS presentation.pptx
ReactJS presentation.pptxReactJS presentation.pptx
ReactJS presentation.pptx
 
An Introduction to ReactJS
An Introduction to ReactJSAn Introduction to ReactJS
An Introduction to ReactJS
 
Redux Toolkit - Quick Intro - 2022
Redux Toolkit - Quick Intro - 2022Redux Toolkit - Quick Intro - 2022
Redux Toolkit - Quick Intro - 2022
 
ReactJs
ReactJsReactJs
ReactJs
 

Ähnlich wie Introduction to React JS

Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]GDSC UofT Mississauga
 
The Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSThe Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSWeblineIndia
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSIRJET Journal
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js SimplifiedSunil Yadav
 
Installing Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdfInstalling Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdfSufalam Technologies
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projectsSkillPracticalEdTech
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
what is context API and How it works in React.pptx
what is context API and How it works in React.pptxwhat is context API and How it works in React.pptx
what is context API and How it works in React.pptxBOSC Tech Labs
 
Why Use React Js A Complete Guide (1).pdf
Why Use React Js A Complete Guide (1).pdfWhy Use React Js A Complete Guide (1).pdf
Why Use React Js A Complete Guide (1).pdfKaty Slemon
 
ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...IRJET Journal
 
React Native’s New Architecture Decoded: How to Migrate & Benefits?
React Native’s New Architecture Decoded: How to Migrate & Benefits? React Native’s New Architecture Decoded: How to Migrate & Benefits?
React Native’s New Architecture Decoded: How to Migrate & Benefits? jhonmiller20
 
How To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptxHow To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptxBOSC Tech Labs
 

Ähnlich wie Introduction to React JS (20)

learning react
learning reactlearning react
learning react
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]Full Stack React Workshop [CSSC x GDSC]
Full Stack React Workshop [CSSC x GDSC]
 
The Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJSThe Best Guide to Know What, Why, When to Use Is ReactJS
The Best Guide to Know What, Why, When to Use Is ReactJS
 
Reactjs
ReactjsReactjs
Reactjs
 
FRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JSFRONTEND DEVELOPMENT WITH REACT.JS
FRONTEND DEVELOPMENT WITH REACT.JS
 
React Js Simplified
React Js SimplifiedReact Js Simplified
React Js Simplified
 
React JS .NET
React JS .NETReact JS .NET
React JS .NET
 
Installing Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdfInstalling Webpack with React JS from Scratch.pdf
Installing Webpack with React JS from Scratch.pdf
 
Skill practical javascript diy projects
Skill practical javascript diy projectsSkill practical javascript diy projects
Skill practical javascript diy projects
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
ReactJS.pptx
ReactJS.pptxReactJS.pptx
ReactJS.pptx
 
React Native
React Native React Native
React Native
 
what is context API and How it works in React.pptx
what is context API and How it works in React.pptxwhat is context API and How it works in React.pptx
what is context API and How it works in React.pptx
 
NEXT.JS
NEXT.JSNEXT.JS
NEXT.JS
 
Why Use React Js A Complete Guide (1).pdf
Why Use React Js A Complete Guide (1).pdfWhy Use React Js A Complete Guide (1).pdf
Why Use React Js A Complete Guide (1).pdf
 
react-en.pdf
react-en.pdfreact-en.pdf
react-en.pdf
 
ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...
 
React Native’s New Architecture Decoded: How to Migrate & Benefits?
React Native’s New Architecture Decoded: How to Migrate & Benefits? React Native’s New Architecture Decoded: How to Migrate & Benefits?
React Native’s New Architecture Decoded: How to Migrate & Benefits?
 
How To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptxHow To Upgrade The React 18 Release Candidate.pptx
How To Upgrade The React 18 Release Candidate.pptx
 

Mehr von Bethmi Gunasekara

Electron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesElectron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesBethmi Gunasekara
 
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...Bethmi Gunasekara
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingBethmi Gunasekara
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageBethmi Gunasekara
 
Web Portal for Construction Industry
Web Portal for Construction IndustryWeb Portal for Construction Industry
Web Portal for Construction IndustryBethmi Gunasekara
 

Mehr von Bethmi Gunasekara (6)

Electron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologiesElectron JS | Build cross-platform desktop applications with web technologies
Electron JS | Build cross-platform desktop applications with web technologies
 
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
General Framework for Sentiment Analysis of Twitter Data, with Special Attent...
 
TestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit TestingTestNG - The Next Generation of Unit Testing
TestNG - The Next Generation of Unit Testing
 
Html 5 - What's new?
Html 5 - What's new?Html 5 - What's new?
Html 5 - What's new?
 
No SQL- The Future Of Data Storage
No SQL- The Future Of Data StorageNo SQL- The Future Of Data Storage
No SQL- The Future Of Data Storage
 
Web Portal for Construction Industry
Web Portal for Construction IndustryWeb Portal for Construction Industry
Web Portal for Construction Industry
 

Kürzlich hochgeladen

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 

Kürzlich hochgeladen (20)

How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Introduction to React JS

  • 2. What is React? React is a declarative, efficient, and flexible JavaScript library for building user interfaces. 2
  • 5. Build components, not templates ● UI Components are the cohesive units ● UI description and UI logic ● Full power of JavaScript to express UI 5
  • 6. React challenges established best practices in traditional MVC framework React can also render on the server using Node, and it can power native apps using React Native. React implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding. 6
  • 8. 1. JSX JSX is JavaScript syntax extension. It isn't necessary to use JSX in React development, but it is recommended. 8
  • 9. 2. Components React is all about components. You need to think of everything as a component. This will help you to maintain the code when working on larger scale projects. 9
  • 10. 3. Unidirectional data flow and Flux React implements one way data flow which makes it easy to reason about your app. Flux is a pattern that helps keeping your data unidirectional 10
  • 11. 4. License React is licensed under the Facebook Inc. Documentation is licensed under CC BY 4.0. 11
  • 12. React Advantages ● React uses virtual DOM which is JavaScript object. This will improve apps performance since JavaScript virtual DOM is faster than the regular DOM. ● React can be used on client and server side. ● Component and Data patterns improve readability which helps to maintain larger apps. ● React can be used with other frameworks 12
  • 13. React Limitations ● React only covers view layer of the app so you still need to choose other technologies to get a complete tooling set for development. ● React is using inline templating and JSX. This can seem awkward to some developers. 13
  • 15. While React can be used without a build pipeline, it is recommend to use it up to be more productive. A modern build pipeline typically consists of: 1. Package manager - Yarn or npm. It lets you take advantage of a vast ecosystem of third-party packages, and easily install or update them. 2. Bundler - webpack or Browserify. It lets you write modular code and bundle it together into small packages to optimize load time. 3. Compiler - Babel. It lets you write modern JavaScript code that still works in older browsers. 15
  • 16. Using a CDN <script src="https://unpkg.com/react@15/dist/react.min.js"></script> <script src="https://unpkg.com/react-dom@15/dist/react-dom.min.js"></script> 16
  • 17. create-react-app ● Create React apps with no build configuration. npm install -g create-react-app create-react-app my-app cd my-app/ npm start 17
  • 18. Create React App is the best way to start building a new React single page application. It sets up your development environment so that you can use the latest JavaScript features, provides a nice developer experience, and optimizes your app for production. Create React App doesn't handle backend logic or databases; it just creates a frontend build pipeline, so you can use it with any backend you want. It uses webpack, Babel and ESLint under the hood, but configures them for you. 18
  • 20. React uses JSX for templating instead of regular JavaScript. It is not necessary to use it, but there are some pros that comes with it. ● JSX is faster because it performs optimization while compiling code to JavaScript. ● It is also type-safe and most of the errors can be caught during compilation. ● JSX makes it easier and faster to write templates if you are familiar with HTML. 20
  • 21. 1. Nested Elements class App extends React.Component { render() { return ( <div> <h1>Header</h1> <h2>Content</h2> <p>This is the content!!!</p> </div> ); } } 21
  • 22. 2. JavaScript Expressions class App extends React.Component { render() { return ( <div> <h1>{1+1}</h1> </div> ); } } 22
  • 23. 3. Styling class App extends React.Component { render() { var myStyle = { fontSize: 100, color: '#FF0000' } return ( <div> <h1 style = {myStyle}>Header</h1> </div> ); } } 23
  • 24. Components & Props Components let you split the UI into independent, reusable pieces, and think about each piece in isolation. They accept arbitrary inputs (called "props") and return React elements describing what should appear on the screen. 24
  • 25. class Welcome extends React.Component { render() { return <h1>Hello, {this.props.name}</h1>; } } function Welcome(props) { return <h1>Hello, {props.name}</h1>; } With ES6Javascript function 25
  • 26. But Props are Read-Only! All React components must act like pure functions with respect to their props. Components can be reused 26
  • 27. State allows React components to change their output over time in response to user actions, network responses, and anything else, without violating this rule. State 27
  • 28. class App extends React.Component { constructor(props) { super(props); this.state = { header: "Header from state...", "content": "Content from state..." } } render() { return ( <div> <h1>{this.state.header}</h1> <h2>{this.state.content}</h2> </div> ); } } export default App; State is the place where the data comes from. Always try to make your state as simple as possible and minimize number of stateful components. If you have, for example, ten components that need data from the state, you should create one container component that will keep the state for all of them. 28
  • 29. 1. Components 2. Backend 3. Maintainable code 4. Learning curve Thinking in React 29
  • 30. ● React is a library for building composable user interfaces. ● It encourages the creation of reusable UI components which present data that changes over time. ● Lots of people use React as the V in MVC. ● React abstracts away the DOM from you, giving a simpler programming model and better performance. ● React can also render on the server using Node, and it can power native apps using React Native. ● Implements one-way reactive data flow which reduces boilerplate and is easier to reason about than traditional data binding. Summary 30