Functional components are lightweight; they don't have any state or lifecycle. They do, however, support some metadata options. For example, you can specify the default property values of functional components the same way you would with a class component. Here's an example of what this looks like:
import React from 'react';
const MyButton = ({ disabled, text }) => (
<button disabled={disabled}>{text}</button>
);
MyButton.defaultProps = {
text: 'My Button',
disabled: false
};
export default MyButton;
The defaultProps property is defined on a function instead of a class. When React encounters a functional component with this property, it knows to pass in the default properties if they're not provided via JSX.
Functional components are an important part of React applications because they're highly focused on taking property values and rendering markup that uses these values. The term "pure function...