Posts

Showing posts from October, 2020

React JS. esas meqamlar

props ve state haqqinda props bir componentden digerine data dashimaq uchun istifade olunur. state ise bir basha componente aid olan bir ozellikdir. state deyishdiyi zaman componentin render funksiyasi ishe dushur ve sehife yeniden generasiya olunur. bele bir veziyyet dushunek ki, Parent componentden child component e bir data gonderirik. bu data parentin statein de saxlanib.  <Child someData = {this.state.someData}> </Child> bu child component bu data ile her hansisa html generasiya eleyir. daha sonra parent componentin state datasi deyishir. burda bele bir hal yaranir ki, child a gonderilen data bir basha parent in datasindan asilidir. parentin datasi deyishdiyine gore child in da datasi deyishir ve yeniden render funksiyasi ishe dushur. method istifadesi addToCart = (product) => {    alert(product.productName + " added to cart!"); } <Button     onClick={() => this.addToCart(product)}     color="success">     <span style={{ fontWeight: &