DEV Community

FatimaAlam1234
FatimaAlam1234

Posted on

React Functional Component

import React from "react"

const App = () => {
return (
<>
<h1>Hello World</h1>
<h1>Hi</h1>
</>
);
};

export default App;
Enter fullscreen mode Exit fullscreen mode

Importing React is a good practice.
Functional component should always return(<>...</>) something and only 1 thing.
For the above reason even when we have 2 h1 tags we wrap them around in a fragment to return it as a single component.

Top comments (0)