O'Reilly logo

TypeScript Blueprints by Ivo Gabe de Wolff

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting started with React

Just like Angular, React is component based. Angular is called a framework, whereas React is called a library. This means that Angular provides a lot of different functionalities and React provides one functionality, views. In the first two chapters, we used the HTTP service of Angular. React does not provide such a service, but you can use other libraries from npm instead.

Creating a component with JSX

A component is a class that has a render method. That method will render the view and is the replacement of the template in Angular. A simple component would look like the following:

export class Example extends React.Component<{}, {}> { render() { const name = "World"; return ( <div> Hello, { name }! <button onClick={() ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required