What are stateful and stateless components?
Whether you’re completely new to the React world, or you’ve been here for a little while, you have probably heard the terms stateful and stateless components. These terms were especially useful before the introduction of hooks in ReactJS v16.8. Don’t worry about hooks right now—we’ll get to them toward the end of this chapter.
From a high-level perspective, ReactJS and React Native components are nothing more than JavaScript functions. The React library adds some specific features to those functions. One of those features is state, a special kind of component memory that we looked at in the previous section.
A React component that can accept state may look like this:
class Welcome extends React.Component { constructor(props) { super(props); this.state = {name: "World"} }; render() { &...