SlideShare uma empresa Scribd logo
1 de 28
USING REACT WITH METEOR
by Neha
What we will Learn
● Simple Rendering
● Updating
● Conditional Rendering
React JSX
JSX
● JSX is a syntax extension to JavaScript.
● Its tag syntax is neither a string nor HTML, e.g.
const element = <h1>Hello, world!</h1>;
● You can embed any JavaScript expression in JSX
● By wrapping it in curly braces, e.g.
○ {2 + 2}
JSX
function getGreeting(user) {
if (user) {
return <h1>Hello, {formatName(user)}!</h1>;
}
return <h1>Hello, Stranger.</h1>;
}
After compilation, JSX expressions become regular JS objects.
So we can:
● Use JSX inside if statements and for loops
● Assign it to variables
JSX
Specifying Attributes with JSX:
● String literals with quotes:
const element = <div className="container"></div>;
● JS expressions with curly braces:
const element = <img src={user.avatarUrl}></img>;
● React DOM uses camelCase property naming convention
Setup Meteor App
Setup Meteor App
● Create meteor app:
○ meteor create react-workshop
OR download starter files: https://goo.gl/gYHDUL
● Remove blaze and other packages:
○ meteor remove blaze-html-templates autopublish insecure
● Add React:
Adding React Component
Component: App.jsx
// Add: imports/ui/components/App.jsx
import React from 'react';
import { Meteor } from 'meteor/meteor';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div id="container">
{/* some html elements here */}
</div>
);
}
}
Simple Rendering
React DOM
What is React DOM?
● React DOM uses Virtual DOM concept
● It is used to manipulate the contents of our app view
● DOM-specific methods can be used at the top level of
our app
● Used via react-dom package
ReactDOM.render()
DOM Specific React Method:
● Renders a React element into the DOM in the supplied
container
● Return a reference to the component
● Controls the contents of the container node you pass
in.
Rendering an Element into the DOM
● Create a <div> in your HTML file:
○ <div id="app"></div>
● This is a "root" DOM node
● Everything inside it will be managed by React DOM.
client/main.html
<!-- client/main.html -->
<head>
<title>Player Stats</title>
</head>
<body>
<!-- React root node -->
<div id="app"></div>
<!-- React root node ends -->
</body>
client/main.js
// client/main.js
import { Meteor } from 'meteor/meteor';
import React from 'react';
import { render } from 'react-dom';
import App from '../imports/ui/components/App.jsx';
// Render simple react component at startup
Meteor.startup(() => {
render(<App />, document.getElementById('app'));
});
Rendering React Element
(Simple text render)
// imports/ui/components/App.jsx
// ...
render() {
const staticText = 'Meteor Noida';
return (
<div id="container">
<b>Static Text:</b> {staticText}
</div>
);
}
Run the Meteor
app!
Updating
Updating React Element
(Text box, update state)
Add State:
// imports/ui/components/App.jsx
// ...
constructor(props) {
super(props);
this.state = {
text: 'Hello Meteorites!',
};
}
// ...
Updating React Element
(Text box, update state)
Update render function:
// imports/ui/components/App.jsx
render() {
// ...
const { text } = this.state;
return (
// ...
<div id="container">
<b>Dynamic Text:</b> {text}
<br />
</div>
// ...
);
}
Updating React Element
(Text box, update state)
Add input box:
// imports/ui/components/App.jsx
<div id="container">
<b>Dynamic Text:</b> {text}
<br />
<input
type="text"
name="updateText"
value={text}
onChange={this.updateText.bind(this)}
/>
</div> See the React DOM
updates in action!
Updating React Element
(Text box, update state)
Add state handler:
// imports/ui/components/App.jsx
export default class App extends React.Component {
constructor(props) {
// ...
}
updateText(e) {
const text = e.target.value;
this.setState({ text });
}
render() {
// …
}
}
React Only Updates What's Necessary
React DOM:
● Compares the element and its children to the
previous one
● Only applies the DOM updates necessary
● To bring the DOM to the desired state.
Conditional Rendering
Conditional Rendering
(Checkbox to show text)
// imports/ui/components/App.jsx
constructor(props) {
super(props);
this.state = {
text: 'Hello Meteorites!',
show: true,
};
}
Conditional Rendering
(Checkbox to show text)
render() {
const { text, show } = this.state;
// ...
return (
<div id="container">
{/* ... */}
{/* Checkbox to show input text box */}
<b>Show Input Box:</b>
<input
type="checkbox"
name="showInputBox"
checked={show}
onChange={this.toggleInputBox.bind(this)}
/>
<br /><br />
{/* ... */}
</div>
);
}
}
Conditional Rendering
(Checkbox to show text)
// State handler for checkbox
toggleInputBox(e) {
const show = e.target.checked;
this.setState({ show });
}
Conditional Rendering
(Checkbox to show text)
<div id="container">
{/* ... */}
{/* Conditionally render input text box based on checkbox value */}
{
show
? <div>
<input
type="text"
name="updateText"
value={text}
onChange={this.updateText.bind(this)}
/>
<br />
</div>
: null
}
{/* ... */}
</div>
See the Conditional
Rendering in action!

Mais conteúdo relacionado

Mais procurados

Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
Alessandro Molina
 

Mais procurados (20)

React with Redux
React with ReduxReact with Redux
React with Redux
 
REACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScriptREACT.JS : Rethinking UI Development Using JavaScript
REACT.JS : Rethinking UI Development Using JavaScript
 
React for Dummies
React for DummiesReact for Dummies
React for Dummies
 
Repetition is bad, repetition is bad.
Repetition is bad, repetition is bad.Repetition is bad, repetition is bad.
Repetition is bad, repetition is bad.
 
Workshop 3: JavaScript build tools
Workshop 3: JavaScript build toolsWorkshop 3: JavaScript build tools
Workshop 3: JavaScript build tools
 
React.js and Redux overview
React.js and Redux overviewReact.js and Redux overview
React.js and Redux overview
 
7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task7\9 SSIS 2008R2_Training - Script Task
7\9 SSIS 2008R2_Training - Script Task
 
Mobile Day - React Native
Mobile Day - React NativeMobile Day - React Native
Mobile Day - React Native
 
How to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescriptHow to build to do app using vue composition api and vuex 4 with typescript
How to build to do app using vue composition api and vuex 4 with typescript
 
React redux
React reduxReact redux
React redux
 
Async JavaScript Unit Testing
Async JavaScript Unit TestingAsync JavaScript Unit Testing
Async JavaScript Unit Testing
 
Asyc flow control with javascript generators - redux-saga
Asyc flow control with javascript generators - redux-sagaAsyc flow control with javascript generators - redux-saga
Asyc flow control with javascript generators - redux-saga
 
Let's Redux!
Let's Redux!Let's Redux!
Let's Redux!
 
Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]
 
Sqladria 2009 SRC
Sqladria 2009 SRCSqladria 2009 SRC
Sqladria 2009 SRC
 
Stay with React.js in 2020
Stay with React.js in 2020Stay with React.js in 2020
Stay with React.js in 2020
 
PyconIE 2016 - Kajiki, the fast and validated template engine your were looki...
PyconIE 2016 - Kajiki, the fast and validated template engine your were looki...PyconIE 2016 - Kajiki, the fast and validated template engine your were looki...
PyconIE 2016 - Kajiki, the fast and validated template engine your were looki...
 
Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]
 
Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2Reactive & Realtime Web Applications with TurboGears2
Reactive & Realtime Web Applications with TurboGears2
 
Redux workshop
Redux workshopRedux workshop
Redux workshop
 

Semelhante a Using react with meteor

Semelhante a Using react with meteor (20)

Understanding React JSX_ A Beginner's Guide
Understanding React JSX_ A Beginner's GuideUnderstanding React JSX_ A Beginner's Guide
Understanding React JSX_ A Beginner's Guide
 
React outbox
React outboxReact outbox
React outbox
 
React js
React jsReact js
React js
 
React JSX.pptx
React JSX.pptxReact JSX.pptx
React JSX.pptx
 
React & Redux for noobs
React & Redux for noobsReact & Redux for noobs
React & Redux for noobs
 
Let's react - Meetup
Let's react - MeetupLet's react - Meetup
Let's react - Meetup
 
Simple React Todo List
Simple React Todo ListSimple React Todo List
Simple React Todo List
 
Academy PRO: React JS
Academy PRO: React JSAcademy PRO: React JS
Academy PRO: React JS
 
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
Universal JS Web Applications with React - Web Summer Camp 2017, Rovinj (Work...
 
Getting Started with React v16
Getting Started with React v16Getting Started with React v16
Getting Started with React v16
 
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark Brocato
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark BrocatoSenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark Brocato
SenchaCon 2016: Ext JS + React: A Match Made in UX Heaven - Mark Brocato
 
ReactJS
ReactJSReactJS
ReactJS
 
Introduction to React JS for beginners
Introduction to React JS for beginners Introduction to React JS for beginners
Introduction to React JS for beginners
 
Custom gutenberg block development in react
Custom gutenberg block development in reactCustom gutenberg block development in react
Custom gutenberg block development in react
 
Server side rendering with React and Symfony
Server side rendering with React and SymfonyServer side rendering with React and Symfony
Server side rendering with React and Symfony
 
React js t2 - jsx
React js   t2 - jsxReact js   t2 - jsx
React js t2 - jsx
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
How to create components in react js
How to create components in react jsHow to create components in react js
How to create components in react js
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 
React/Redux
React/ReduxReact/Redux
React/Redux
 

Mais de NodeXperts

Mais de NodeXperts (20)

ECMA Script
ECMA ScriptECMA Script
ECMA Script
 
Apollo Server IV
Apollo Server IVApollo Server IV
Apollo Server IV
 
React Context API
React Context APIReact Context API
React Context API
 
Devops - Microservice and Kubernetes
Devops - Microservice and KubernetesDevops - Microservice and Kubernetes
Devops - Microservice and Kubernetes
 
Introduction to EC2 (AWS)
Introduction to EC2 (AWS)Introduction to EC2 (AWS)
Introduction to EC2 (AWS)
 
Reactive Application Using METEOR
Reactive Application Using METEORReactive Application Using METEOR
Reactive Application Using METEOR
 
Apollo server II
Apollo server IIApollo server II
Apollo server II
 
Apollo Server
Apollo ServerApollo Server
Apollo Server
 
Apollo Server III
Apollo Server IIIApollo Server III
Apollo Server III
 
Getting Reactive Data
Getting Reactive DataGetting Reactive Data
Getting Reactive Data
 
State, Life cycle, Methods & Events
State, Life cycle, Methods & Events State, Life cycle, Methods & Events
State, Life cycle, Methods & Events
 
Refs in react
Refs in reactRefs in react
Refs in react
 
Flow router, components and props
Flow router, components and propsFlow router, components and props
Flow router, components and props
 
Introduction to Reactjs
Introduction to ReactjsIntroduction to Reactjs
Introduction to Reactjs
 
Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1Mobile apps using meteor - Part 1
Mobile apps using meteor - Part 1
 
Microservice architecture : Part 1
Microservice architecture : Part 1Microservice architecture : Part 1
Microservice architecture : Part 1
 
Reactive web applications using MeteorJS
Reactive web applications using MeteorJSReactive web applications using MeteorJS
Reactive web applications using MeteorJS
 
Improving build solutions dependency management with webpack
Improving build solutions  dependency management with webpackImproving build solutions  dependency management with webpack
Improving build solutions dependency management with webpack
 
Meteor workshop
Meteor workshopMeteor workshop
Meteor workshop
 
Introduction to meteor
Introduction to meteorIntroduction to meteor
Introduction to meteor
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Using react with meteor

  • 1. USING REACT WITH METEOR by Neha
  • 2. What we will Learn ● Simple Rendering ● Updating ● Conditional Rendering
  • 4. JSX ● JSX is a syntax extension to JavaScript. ● Its tag syntax is neither a string nor HTML, e.g. const element = <h1>Hello, world!</h1>; ● You can embed any JavaScript expression in JSX ● By wrapping it in curly braces, e.g. ○ {2 + 2}
  • 5. JSX function getGreeting(user) { if (user) { return <h1>Hello, {formatName(user)}!</h1>; } return <h1>Hello, Stranger.</h1>; } After compilation, JSX expressions become regular JS objects. So we can: ● Use JSX inside if statements and for loops ● Assign it to variables
  • 6. JSX Specifying Attributes with JSX: ● String literals with quotes: const element = <div className="container"></div>; ● JS expressions with curly braces: const element = <img src={user.avatarUrl}></img>; ● React DOM uses camelCase property naming convention
  • 8. Setup Meteor App ● Create meteor app: ○ meteor create react-workshop OR download starter files: https://goo.gl/gYHDUL ● Remove blaze and other packages: ○ meteor remove blaze-html-templates autopublish insecure ● Add React:
  • 10. Component: App.jsx // Add: imports/ui/components/App.jsx import React from 'react'; import { Meteor } from 'meteor/meteor'; export default class App extends React.Component { constructor(props) { super(props); } render() { return ( <div id="container"> {/* some html elements here */} </div> ); } }
  • 12. React DOM What is React DOM? ● React DOM uses Virtual DOM concept ● It is used to manipulate the contents of our app view ● DOM-specific methods can be used at the top level of our app ● Used via react-dom package
  • 13. ReactDOM.render() DOM Specific React Method: ● Renders a React element into the DOM in the supplied container ● Return a reference to the component ● Controls the contents of the container node you pass in.
  • 14. Rendering an Element into the DOM ● Create a <div> in your HTML file: ○ <div id="app"></div> ● This is a "root" DOM node ● Everything inside it will be managed by React DOM.
  • 15. client/main.html <!-- client/main.html --> <head> <title>Player Stats</title> </head> <body> <!-- React root node --> <div id="app"></div> <!-- React root node ends --> </body>
  • 16. client/main.js // client/main.js import { Meteor } from 'meteor/meteor'; import React from 'react'; import { render } from 'react-dom'; import App from '../imports/ui/components/App.jsx'; // Render simple react component at startup Meteor.startup(() => { render(<App />, document.getElementById('app')); });
  • 17. Rendering React Element (Simple text render) // imports/ui/components/App.jsx // ... render() { const staticText = 'Meteor Noida'; return ( <div id="container"> <b>Static Text:</b> {staticText} </div> ); } Run the Meteor app!
  • 19. Updating React Element (Text box, update state) Add State: // imports/ui/components/App.jsx // ... constructor(props) { super(props); this.state = { text: 'Hello Meteorites!', }; } // ...
  • 20. Updating React Element (Text box, update state) Update render function: // imports/ui/components/App.jsx render() { // ... const { text } = this.state; return ( // ... <div id="container"> <b>Dynamic Text:</b> {text} <br /> </div> // ... ); }
  • 21. Updating React Element (Text box, update state) Add input box: // imports/ui/components/App.jsx <div id="container"> <b>Dynamic Text:</b> {text} <br /> <input type="text" name="updateText" value={text} onChange={this.updateText.bind(this)} /> </div> See the React DOM updates in action!
  • 22. Updating React Element (Text box, update state) Add state handler: // imports/ui/components/App.jsx export default class App extends React.Component { constructor(props) { // ... } updateText(e) { const text = e.target.value; this.setState({ text }); } render() { // … } }
  • 23. React Only Updates What's Necessary React DOM: ● Compares the element and its children to the previous one ● Only applies the DOM updates necessary ● To bring the DOM to the desired state.
  • 25. Conditional Rendering (Checkbox to show text) // imports/ui/components/App.jsx constructor(props) { super(props); this.state = { text: 'Hello Meteorites!', show: true, }; }
  • 26. Conditional Rendering (Checkbox to show text) render() { const { text, show } = this.state; // ... return ( <div id="container"> {/* ... */} {/* Checkbox to show input text box */} <b>Show Input Box:</b> <input type="checkbox" name="showInputBox" checked={show} onChange={this.toggleInputBox.bind(this)} /> <br /><br /> {/* ... */} </div> ); } }
  • 27. Conditional Rendering (Checkbox to show text) // State handler for checkbox toggleInputBox(e) { const show = e.target.checked; this.setState({ show }); }
  • 28. Conditional Rendering (Checkbox to show text) <div id="container"> {/* ... */} {/* Conditionally render input text box based on checkbox value */} { show ? <div> <input type="text" name="updateText" value={text} onChange={this.updateText.bind(this)} /> <br /> </div> : null } {/* ... */} </div> See the Conditional Rendering in action!

Notas do Editor

  1. Applications built with React usually have a single root DOM node. To render a React element into a root DOM node, pass both to ReactDOM.render() Now we will see how this is done...