What Are Stateful and Stateless Components?
Learn about stateful and stateless components in React Native.
Whether we’re completely new to the React world or have been here for a little while, we have probably heard the terms stateful and stateless components. These terms were especially useful before the introduction of hooks in ReactJS v16.8.
Stateful components
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.
A React component that can accept state can look like this:
Get hands-on with 1300+ tech skills courses.