React Function Components
March 24, 2020
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.
JSX
x
9
1
function App(props) {
2
let message = "Welcome!"; //no state property ==> stateless component
3
return (
4
<div>
5
<p>My message: {message}</p>
6
<p>Parent's message: {props.message}</p>
7
</div>
8
);
9
}