0% found this document useful (0 votes)
32 views1 page

React 3

The document discusses how to create functions and components in React. It explains that components must be wrapped in a parent element like <div> or <p> unless using React fragments. It also covers using comments in and outside of return statements.

Uploaded by

5 Aditya Kr. 8C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views1 page

React 3

The document discusses how to create functions and components in React. It explains that components must be wrapped in a parent element like <div> or <p> unless using React fragments. It also covers using comments in and outside of return statements.

Uploaded by

5 Aditya Kr. 8C
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

App.

jsx -

How to create a function>?


there are two ways-
* const App - () ->
* function App()

* whatever we want to be displayed on the website inside a component , we write it


in- return(

Why is <div> tag required?


- whatever html tag you write inside return it has to be wrapped inside a parent
element i.e <div>. If you have multiple components
they cannot exsist parallely , until and unless they are wrapped with some tag.
* you ca also write <p> tag instead of <div> tag.

* What if you don't want <div> or <p> tag ::??


-> If you don't want any error even after having multiple components then you use
React fragments i.e empty open and closed tag
<>....<>

COMMENTS-
* inside return - {/*......*/} shortcut key- Ctrl + slash
* outside return - //

import "./styles.css";

function App() {
return (
<p>
<h1> Hoiii world </h1>
<h2> I m pretty better in doing work</h2>
</p>
);
}
export default App;

You might also like