Functional Components

Pascual Vila
Frontend Instructor.
Functional components are one way to define components in React. They are JavaScript functions that accept props and return JSX (the visual representation of the user interface). Starting from React 16.8, functional components can also use hooks like useState and useEffect.
Example of a Functional Component:
{`import React, { useState } from "react";
function Counter() {
const [count, setCount] = useState(0);
return (
<div>
<h1>Counter: {count}</h1>
<button onClick={() => setCount(count + 1)}>Increment</button>
</div>
);
}
export default Counter;`}