JavaScript FrameworksReact

React Function Components

Function components cannot have access to the state property since functions are not a class. Thus a component that does not have a state property is called a “stateless component” – all function components are stateless. Because they’re simple and stateless, they do not have the common lifecycle hooks either.

function App(props) {
  let message = "Welcome!"; //no state property ==> stateless component
  return ( 
    <div>
      <p>My message: {message}</p>
      <p>Parent's message: {props.message}</p>
    </div> 
  );  
}
Verified by MonsterInsights