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 ( 
      <p>My message: {message}</p>
      <p>Parent's message: {props.message}</p>
Verified by MonsterInsights