...

/

React Component Definition (Advanced)

React Component Definition (Advanced)

Let's go over another way to define the react component.

The following refactorings are optional recommendations to explain the different JavaScript/React patterns. You can build complete React applications without these advanced patterns, so don’t be discouraged if they seem too complicated.

All components in the src/App.js file are function components. JavaScript has multiple ways to declare functions. So far, we have used the function statement, though arrow functions can be used more concisely:

Press + to interact
// function declaration
function () { ... }
// arrow function declaration
const () => { ... }

You can remove the parentheses in an arrow function ...