15
loading...
This website collects cookies to deliver better user experience
<script src="https://unpkg.com/react/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js">
</script>
//Earlier there is only one single file but nowadays it splits up in the 2 files.
1st File is for React -> To make Changes in the JavaScript or for Javascript also the same file we include in the during our App Development.
The 2nd File is used for DOM Manipulation.
<script src="https://unpkg.com/babel-standalone"></script>
Also we have include another
file called Babel
It is used to convert the HTML like code into the
Java-Script.
Also we have to tell the
Compiler that there can be JSX in there
<script src="index.js" type="text/jsx"></script>**
<div id="root">
</div>
**We can select this using getElementById and Insert the HTML in it.**
Let's make a Hello world Component ->
class Hello extends React.Component{
render(){
return <H1> Hello World</H1>
}
}
-> But this only Return not manipulate the HTML
so for this we have
ReactDOM(<Component name>,<Where to Render it>)
ReactDOM(<Hello/>,document.getElementById('root')); <- this will print the Hello world
**But what if we want to return Multiple things ?? return can only return only one thing
for this we can wrap it in a div**
class Hello extends React.Component{
render(){
return (
<div>
<H1> Hello World</H1>
<H1> Hello World</H1>
</div>
)
}
}
-> By this way we can print the Multiple things in it.