SlideShare a Scribd company logo
Introduction to JSX
Micah Wood
@wpscholar
https://wpscholar.com
JSX Basics
Root Element
There can only be one root
element.*
*Except when using the <Fragment /> component.
Introduction to JSX
Attribute Names
Always camel case except when
using data-* or aria-*.
Use className instead of class
and htmlFor instead of for.
Introduction to JSX
Introduction to JSX
Expressions
An expression is any valid unit of
code that resolves to a value.
Boolean, null and undefined
values are ignored.
Introduction to JSX
Introduction to JSX
Boolean
Attributes
An attribute with no value
defaults to true.
A boolean value will cause an
attribute to be toggled.
Introduction to JSX
Custom
Components
Custom components always start
with an uppercase letter.
Introduction to JSX
Self-closing Tags
Components with no children
should use a self-closing tag.
Introduction to JSX
Comments
If you need to leave a comment in
JSX, you can do so using a single-
line or multi-line syntax.
Single Line Comment
Multi-line Comment
Nested Components
Nested Children
Components that support the
display of children, can accept
children via nesting.
Text as a child
Element as a child
Children Prop
Components that support the
display of children, can also
accept children via the `children`
property.
Introduction to JSX
Rendering
Multiple Children
Returning an array will allow you
to render multiple children.
However, JSX requires that you
set a `key` property for child
components.
An array of text strings
An array of components
An array of components
Rendering
Children
Use the `children` property to
render children via JSX.
Introduction to JSX
Form Fields
Uncontrolled
Inputs
An uncontrolled input uses the
`defaultValue` property and
doesn’t do anything when the
field is changed.
Uncontrolled Input
Controlled Inputs
A controlled input uses the
`value` and `onChange`
properties and is used when
something should happen when
the value changes.
Controlled Input
Select Field
A select field in JSX uses the
`value` property to automatically
manage the selected item.
Introduction to JSX
Textarea
A textarea field in JSX is self
closing since the value is passed
as a property.
Introduction to JSX
Conditional Rendering
The && Operator
Use the && operator when you
just need to toggle the display of
a component.
Introduction to JSX
Ternary Operator
Use the ternary operator when
you need to display one
component as opposed to
another.
Ternary operator to toggle text
Ternary operator to toggle a component
Advanced JSX
Spread
Attributes
The spread operator can be used
to dynamically pass attributes to
a component.
Introduction to JSX
Functions as
Children
If you ever need to customize the
display logic of children from
outside of a component, a render
function is a great option.
Introduction to JSX
React Dev Tools
The “React Dev Tools” extension
for Google Chrome is very
helpful when trying to debug
your React code.
Introduction to JSX
Resources
Resources
● Babel REPL - https://babeljs.io/repl
● React Live - https://react-live.kitten.sh/
● JSX Intro- https://reactjs.org/docs/introducing-jsx.html
● JSX in Depth - https://reactjs.org/docs/jsx-in-depth.html
● React Dev Tools - http://bit.ly/2IME9a9
● Create React App - http://bit.ly/2JWtej8
Introduction to JSX
Micah Wood
@wpscholar
https://wpscholar.com

More Related Content

PPTX
ReactJS presentation.pptx
PPTX
React JS - A quick introduction tutorial
PDF
An introduction to React.js
PPTX
Intro to React
PPTX
PDF
ReactJS presentation
PPTX
React js programming concept
PDF
Workshop 21: React Router
ReactJS presentation.pptx
React JS - A quick introduction tutorial
An introduction to React.js
Intro to React
ReactJS presentation
React js programming concept
Workshop 21: React Router

What's hot (20)

PPTX
Introduction to React JS for beginners
PPTX
Introduction to React JS for beginners | Namespace IT
PPTX
Its time to React.js
PPTX
[Final] ReactJS presentation
PDF
React new features and intro to Hooks
PPTX
React hooks
PDF
React Js Simplified
PPTX
React hooks
PPTX
PDF
React js
PPTX
React + Redux Introduction
PPTX
Reactjs
PDF
React JS and why it's awesome
PDF
Introduction to React JS
PPTX
React js for beginners
PDF
Lets make a better react form
PPTX
React js
PPTX
React-JS.pptx
PDF
WEB DEVELOPMENT USING REACT JS
PPTX
What is component in reactjs
Introduction to React JS for beginners
Introduction to React JS for beginners | Namespace IT
Its time to React.js
[Final] ReactJS presentation
React new features and intro to Hooks
React hooks
React Js Simplified
React hooks
React js
React + Redux Introduction
Reactjs
React JS and why it's awesome
Introduction to React JS
React js for beginners
Lets make a better react form
React js
React-JS.pptx
WEB DEVELOPMENT USING REACT JS
What is component in reactjs
Ad

Similar to Introduction to JSX (20)

PDF
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
PDF
Why I Love JSX!
PDF
Understanding React JSX_ A Beginner's Guide
PDF
Learn react by Etietop Demas
PPTX
Learn react.js with me!
PPTX
Unit 2 Fundamentals of React -------.pptx
PPTX
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
PPTX
React Workshop
PDF
React enlightenment
PPTX
slides.pptx
PPTX
slides.pptx
PDF
Introduction to ReactJS
PDF
Master React in 20 Days !.pdf used for react
PPTX
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
PPTX
Internal workshop react-js-mruiz
PDF
Stay with React.js in 2020
PPTX
React & Redux for noobs
PPTX
React JSX.pptx
PDF
Lezione 03 Introduzione a react
PDF
react hook and wesite making structure ppt
unit 3_Adv WTAdvanced Web Tecg Design_HTML_CSS_JAVASCRIPT_AJAX_PPT.pdf
Why I Love JSX!
Understanding React JSX_ A Beginner's Guide
Learn react by Etietop Demas
Learn react.js with me!
Unit 2 Fundamentals of React -------.pptx
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React Workshop
React enlightenment
slides.pptx
slides.pptx
Introduction to ReactJS
Master React in 20 Days !.pdf used for react
Internet and Web Technology (CLASS-9) [React.js] | NIC/NIELIT Web Technology
Internal workshop react-js-mruiz
Stay with React.js in 2020
React & Redux for noobs
React JSX.pptx
Lezione 03 Introduzione a react
react hook and wesite making structure ppt
Ad

More from Micah Wood (18)

PDF
WP-CLI For The Win
PDF
Using Chrome Dev Tools
PDF
Shortcodes In-Depth
PDF
Becoming a WordPress Coding Master
PDF
Debugging in PHP
PDF
WordPress Hooks
PDF
The Modern JavaScript Developers Toolbox
PDF
Using Composer with WordPress
PDF
An Introduction to PHP Classes
PDF
Backbone + React
PDF
Advanced Development Workflows
PDF
Testing Made Easy
PDF
Debugging in PHP
PDF
Troubleshooting WordPress Issues
PDF
Using Composer with WordPress - 2.0
PDF
Using composer with WordPress
PDF
Sanitizing, Validating and Escaping in WordPress Themes and Plugins
PPTX
Getting Started with Vagrant
WP-CLI For The Win
Using Chrome Dev Tools
Shortcodes In-Depth
Becoming a WordPress Coding Master
Debugging in PHP
WordPress Hooks
The Modern JavaScript Developers Toolbox
Using Composer with WordPress
An Introduction to PHP Classes
Backbone + React
Advanced Development Workflows
Testing Made Easy
Debugging in PHP
Troubleshooting WordPress Issues
Using Composer with WordPress - 2.0
Using composer with WordPress
Sanitizing, Validating and Escaping in WordPress Themes and Plugins
Getting Started with Vagrant

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Electronic commerce courselecture one. Pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PPTX
Tartificialntelligence_presentation.pptx
PDF
Empathic Computing: Creating Shared Understanding
PDF
Encapsulation theory and applications.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Machine learning based COVID-19 study performance prediction
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
A comparative analysis of optical character recognition models for extracting...
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
“AI and Expert System Decision Support & Business Intelligence Systems”
Electronic commerce courselecture one. Pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Tartificialntelligence_presentation.pptx
Empathic Computing: Creating Shared Understanding
Encapsulation theory and applications.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Machine learning based COVID-19 study performance prediction
Network Security Unit 5.pdf for BCA BBA.
A comparative analysis of optical character recognition models for extracting...
Digital-Transformation-Roadmap-for-Companies.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The Rise and Fall of 3GPP – Time for a Sabbatical?
Diabetes mellitus diagnosis method based random forest with bat algorithm
MIND Revenue Release Quarter 2 2025 Press Release
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...

Introduction to JSX