Stateless and stateful components

First of all, let's look at the first stateless component that has been created for us. It has been automatically generated by Create React Native App (CRNA) for our Hello World application. This component was created using the class syntax that was introduced in ECMAScript 2015 (ES6). Such components are usually called class components:

// src/ Chapter 1/ Example 1_Hello World/ App.jsexport default class App extends React.Component {  render() {    return (        <View style={styles.container}>          <Text>Hands-On Design Patterns with React Native</Text>          <Text>Chapter 1: React Component Patterns</Text>          <Text style={styles.text}>You are ready to start the journey.  Fun fact is, this text is rendered by class component called ...

Get Hands-On Design Patterns with React Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.