Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering TypeScript 3

You're reading from   Mastering TypeScript 3 Build enterprise-ready, industrial-strength web applications using TypeScript 3 and modern frameworks

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781789536706
Length 694 pages
Edition 3rd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Nathan Rozentals Nathan Rozentals
Author Profile Icon Nathan Rozentals
Nathan Rozentals
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. TypeScript Tools and Framework Options FREE CHAPTER 2. Types, Variables, and Function Techniques 3. Interfaces, Classes, and Inheritance 4. Decorators, Generics, and Asynchronous Features 5. Declaration Files and Strict Compiler Options 6. Third-Party Libraries 7. TypeScript Compatible Frameworks 8. Test-Driven Development 9. Testing Typescript Compatible Frameworks 10. Modularization 11. Object-Oriented Programming 12. Dependency Injection 13. Building Applications 14. Let's Get Our Hands Dirty 15. Other Books You May Enjoy

Using React

Another TypeScript framework that we will take a look at in this chapter is React. The React framework is open source, and was originally developed by Facebook. React uses a specific inline syntax for combining HTML templates and JavaScript code in the same file, named JSX. There are no string templates to load, like Backbone, or HTML snippets that are in a separate file, like Angular or Aurelia. In React, all templates are mixed in with normal JavaScript code, using an HTML-like syntax. As a simple example of this syntax, consider the following code:

render() { 
    return <div>Hello <span>React</span></div>; 
} 

Here, we have a standard TypeScript function named render. Within this function, we are returning what looks like native HTML, with a <div> and a child <span>. Note that there are no quotation marks around these HTML elements...

lock icon The rest of the chapter is locked
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 €18.99/month. Cancel anytime