Posts

Showing posts with the label Component

React Component || Functional Component || Class Component || composing function component

What is Component? React Components that render html elements and tags Types of Component Functional Component Class Component Functional Component Render html element through function Class Component Render html element through class Composing function component Means call a function component into another function component Functional Component Example Now again make a directory inside root directory        mkdir public (you can take name as you want)        mkdir src (you can take name what ever you want you want) inside public folder create two new file index.html index.js inside src folder create one new file  main.js ( this is file where react app execution is start. you can take name what ever you want). app.js or main.js function Item(){ return(<h1>Hello from Item</h1>) } function Welcome(){ return(<div> <h1>Hello React</h1> <Item />  </div>); } const element = <Welcome /> ReactDOM.render(e

React Component || Functional Component || Class Component

What is Component? React Components that render html elements and tags Types of Component Functional Component Class Component Functional Component Render html element through function Class Component Render html element through class Functional Component Example Now again make a directory inside root directory        mkdir public (you can take name as you want)        mkdir src (you can take name what ever you want you want) inside public folder create two new file index.html index.js inside src folder create one new file  main.js ( this is file where react app execution is start. you can take name what ever you want). app.js or main.js function Welcome(){ return(<h1>Hello React</h1>); } const element = <Welcome /> ReactDOM.render(element, document.getElementById('root')); in index.html <!DOCTYPE html> <html> <head> <title></title> <script crossorigin src="https://unpkg.com/