Event listening in react

 How we can listen to som eevents

some envents fire like click or automatically

user enters into input button , that is event
on word type it is event




responseive

reactive

interactive 

flexible




React add new template part 2

 =

=

must have one parent ellement


     <div>
            <h1>First Component</h1>
            <p>This is the first component</p>
        </div>
import React, { useState } from 'react';
function First(){
   
    return (        
        <div>
            <h1>First Component</h1>
            <p>This is the first component</p>
        </div>
    )
}

export default First;

=

adding styles in jsx 

import './subscription.css';

div className=''



=


=============

dynamic data in jsx react



variables {} 

curly braces

{javascript code valid}


javascript expressions

=


Data passing in react

=

communication between components



pass as prop


let subscription {

{},

{}

}



Accesing props in react




implemetning js code in jsx react



convert date to readable format


creating single responsibilty components in react


component in component

because for date more transformations 


=


=

children props in react


same kind of template in so many places


=


==

other details in jsx react

writing react in  soo many ways




folder staructure

arrow function 



=




what is react

 why react is popular

what are the key functions of react

who can start a career as web developer , ui developer, full stack applicaitons 

component

how to maintain an dpass the data in component

commuinicaion between component


modules what is modules 

what is jsx

how to pass betwen data


simple to learn


waht is react

it is javascript library for building web interfaces

use to buildy higly interactive, flexible, and responsive webinterfaces

interactive -> mobile 

flexible -> page ka breakout nahi, means desktop to mobile at position

responsive => fast,  it will get data from backen but takes speed and 

client side scription 

load the code at browser

it will not load at server


what is spa





this uses dom


like tree




DOM MANIPULATION


--



htmnl dom



why choose react for web development


to render on the scren 

latency decrease

user actiion -> have to react that action

for in javascript -> to write simple action shave to write too much of code

but 

event listener

in javascript we cannot do after event handler calls

but in react we can call that 





in react we can divide the logic into smaller reusable components

component




==

easy to code

easy  to write

easy to understand


realt time example


react vs angular vs vue



in react -> if need any new fatures , u have ot use library

devloping using eract less features , less load on user

less learning time

angular-> so man y features are there which we are not use, heavily loaded



vuejs


setting up project

=

what installations required

visualt studio code 

prettier extension

eslint


auto save in visual studoio 

==

components in react



user given input and output -> interactive user interface

what is rsx


componentns




html,css,javascript basic knowledge

reac is the ligbrary based on the javascript

react js easy to use, code reusability, easy to declare


==

header is one componer

line is one component

pointer is another component

why component sis another component


how do u create component in react





function name an dcomponent must match , maing conventions

write the function in component and export taht



app.js 
import that


=





====

installation of node



node js -> run javascript without browser 

browser hsa capabiltiy when javascript loaded into browser

node js is used by this tool create react app to run some logic


npx create-react-app myfirst app

it willl install react folder, cretre react server




it will install depundencies and abundancies

npm update or install 

to install all the diependices use above

and it will save in  node_modiles

after create react no need to run , npx create it already run the npm install


understanding file staructure

  package.json


after installed u can see bsic files 


package.json

dependecies

scripts

npm start ->

package-lok.json 

information gather, dependices history , from where install whic hversion

and meta data it has

src folder


==

undertand index.js



first file that gets used when u open is indexd.js

where to start the applicaiton 

what is boostrap 

it will there in index.js

it is default file


first file index.html



it will call index.js


imporeted app , app.js is the ocmponent

default react logo will show from app.js

defenelty export


index.js react 

convert to html, javacript


reactdom -> eract dom library

react tdom is used to render something

reactdo.nreder

========================

introduction to jsx




jsx meanss javascript + xml

xml means its one type of html

react juses jsx it is also like html but how its validate

writing html in javascript called jsx


jsx not uneerstad by browser, react will transform itno pure javascript, html, css


mainchunk .js

it has all transformed rect

bundle.js

it has also import no there


pure javascript follows the imperaqtive approach

where u give clear inster


custom components


react introduction

 =

react 

https://www.youtube.com/watch?v=6DP7cMN99zQ

front end , back end , databse


react is a library which is used to develop front end web development


it is used to develop single page application


for example take youtube


on ist time it wll reloads

if we click on anything na it will nto reloads

it will just calling another component


component


it will load wahtever component require instead of all page loads


if all page loads it will call all apis , becasue of this it traffice increase and internet of user will be more



so if we call whatever component calls, it will save


basics


componment

props

state

web page diveide into compoentns

each element we can call as component


take webpage it is divide itno compoentns



to call componentn we are importing where ever we reqired and 


calling components using props


after fetching api, load to state, 


based on the lgoic and work we can divice itno smaller components


reusabilitiy


STA -> 

abc -> ecomerce, cart -> + or - add items

xyz company -> ecommerce -> 


senditn data from outside to component using props

using state -> varaible


once compoennt developed have to show always updated date whenever it calls

instead of getting al data ,get data using pagination


component -> class basec compoentns -> classes it has -> it used state

fbc-> it has functions-> they are using hooks


hoooks -> they are special type functions -> 


node -v 

have to install

npm -v


nodejs used to render react with out browser


vs code is required


extensions


es7 react/redux/graphql by rodrigovallades



npx create-react-app 



npm is a node package manager, based on ur given inputs it will download to local


npx utilising that packages , after our work over its in same code level


usign package.json-> u can get all the modules if modules are lost

online react render


playcode.io/react


run the ap[plication 

npm start


what is jsx

return {html tags}

writin html in js called jsx

return {

<div className="'>


normal html is class

jsx className


html for in form , javascript for loops


html to jsx convertore online tools


https://transform.tools/html-to-jsx


html

<!-- Hello world -->
<div class="awesome" style="border: 1px solid red">
  <label for="name">Enter your name: </label>
  <input type="text" id="name" />
</div>
<p>Enter your HTML here</p>


jsx

<>
  {/* Hello world */}
  <div className="awesome" style={{ border: "1px solid red" }}>
    <label htmlFor="name">Enter your name: </label>
    <input type="text" id="name" />
  </div>
  <p>Enter your HTML here</p>
</>

==

readme.md

what is readme.md ( this project what i doing its telling)

gitignore -> used to ignore some folders whih is used to have large files like images , 


in public

index.html

robots.txt -> which traffice will allow , which traffic will nto allow


manifest.json -> using this we can develop progress web app ( android aplication)

favicon -> icon of website

index.html

div id="root" 

 




src folder

index.js


get root id from index,html

and load data to that id



this app means app.js

app.js 

function based components

how to craete comppnents

in src folder

create cbc.js




rcc type it will create automatically class based components

fbc -> function based components

rfc type

it will create function based components



==


after created call that compoient in app.js

write CBC , it wil automatically import at starting



it wil show in downside 




in cbc

mention 

rco type

it will craete constructor



in fbc 

use usestate hooks



how to pass props

<cbc value='vb' />

<fbc topic="react" />

cbc

<p > t his is {this.props.value} </>

fbc

<p> iam {props.topic} </p>



==

Event listening in react

 How we can listen to som eevents some envents fire like click or automatically user enters into input button , that is event on word type i...