Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Beginning Frontend Development with React [Instructor Edition]

You're reading from   Beginning Frontend Development with React [Instructor Edition] Extend your existing JavaScript skills by building engaging and reactive interfaces for the modern web

Arrow left icon
Product type Hardcover
Published in Jul 2018
Publisher
ISBN-13 9781789530520
Length 96 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Andrea Chiarelli Andrea Chiarelli
Author Profile Icon Andrea Chiarelli
Andrea Chiarelli
Arrow right icon
View More author details
Toc

Using JSX

In previous examples, we defined the visual output returned by the render() method of a component by using an HTML-like markup expression. Let's see, for example, the definition of the Catalog component:

import React from 'react';
import './Catalog.css';

class Catalog extends React.Component {
render() {
return <div><h2>Catalog</h2></div>;
}
}

export default Catalog;

The markup expression is not using JavaScript syntax, but it is included inside of a JavaScript code snippet. Why do we mix HTML and JavaScript syntaxes? How is that possible?

Let's start by saying that the HTML-like language describing the React component's visual output is called JSX. This language extends JavaScript with XML expressions in order to simplify the creation of HTML elements within JavaScript code. You...

lock icon The rest of the chapter is locked

Subscribe to access the full title

Advance your knowledge in tech

A Packt subscription gives you instant online access to our library of over 8,000 practical eBooks and videos, constantly updated with the latest in tech
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon