Well done! You’ve written your first function component. Here’s a recap:
- Function components must return JSX
- Function components may accept a
Although function components and class components can do the same things, you’ll see a lot of function components in the React documentation and example apps. Some developers prefer them over class components for their simplicity and straightforward features, like Hooks, which you’ll learn later in your coding journey.
Take a look at the example in the code editor. Make sure the code makes sense before moving on!