The first component
Here's probably the simplest component we can write, in all it's glory:
It doesn't do much, but still there's a couple of things to notice:
import React from 'react';
- always import Reactconst App: React.FC
- the component is typed as a React'sFunctionalComponent
const App: React.FC = () => { ... }
- it takes no argumentsexport default App;
is exported from the file
A single product component
not exactly the best practice, but for now, the data is hardcoded inside of the component
There's plenty of elements to render, but a component must always return exactly one element or null
Resources
Last updated