Learn to use State in React in 19 minutes (for beginners)

Learn to use State in React in 19 minutes (for beginners)

Sonny Sangha

2 года назад

85,906 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@xperwar
@xperwar - 01.10.2023 13:52

love the content !!

Ответить
@mitotv6376
@mitotv6376 - 09.08.2023 00:03

Nice video

Ответить
@TinyMaths
@TinyMaths - 15.07.2023 23:32

Just come across your channel (I think) and liking the way you explain things.
After just over a year of leaning JavaScript and building many projects, I decided last week to take the plunge and begin learning React. Looks like I'll be frequenting your channel quite a bit.

Ответить
@070tahsin
@070tahsin - 07.03.2023 21:46

Can you also implement the usestate to hide your fucking face middle of the screen

Ответить
@cryptomallu6271
@cryptomallu6271 - 09.02.2023 19:22

best video

Ответить
@CoderSineNomine
@CoderSineNomine - 20.01.2023 13:27

Here i am after almost 5 confusing videos, finally got it! subscribed and looking forward for more.. thanks Sonny!

Ответить
@crappycoders
@crappycoders - 16.12.2022 19:57

Yep thats what i needed before going to building the apps

Ответить
@yaeldekanu9246
@yaeldekanu9246 - 23.11.2022 15:00

Great job! You do a great job explaining everything

Ответить
@MrSirmay1
@MrSirmay1 - 06.09.2022 19:33

Wow I'm happy I began learning React after Hooks came out versus a class system, thank you for sharing.

Ответить
@bernardmuchemi196
@bernardmuchemi196 - 21.08.2022 21:03

We've never seen your lefts side of the face Sonny😂😂

Ответить
@jonroni5756
@jonroni5756 - 15.08.2022 08:13

Hello Sir!
I have problem in useState:

import React, {useState} from 'react'

function App(){
var [data, dataUpdate]=useState(0);
function change(){
dataUpdate(data+1);

}

return (
<div>
<h1>{data}</h1>
<button onClick={()=>change()}>Click Here</button>
</div>
)
}

export default App

Whenever i used useState it shows me the blank page after execution

Ответить
@M.W__69
@M.W__69 - 13.08.2022 10:31

thank you SO SO much

Ответить
@timileyinquadri8668
@timileyinquadri8668 - 09.08.2022 20:42

Hello sonny, you mentioned something about making state persistent with a database, how does this work…or if anyone knows how kindly share, because I have a toggle button that makes a call to an endpoint and every time I refresh the page or go to another tab in the app it resets back to the default

Ответить
@alexios9544
@alexios9544 - 19.07.2022 13:26

Class component is dead my brother 😂

Ответить
@Salah-YT
@Salah-YT - 08.07.2022 12:50

thanx bro here more easy way

const [count, setCount] = useState(0);

return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>Click me +</button>
<button onClick={() => setCount(count - 1)}>Click me -</button>
</div>
);

Ответить
@ruebenhales8558
@ruebenhales8558 - 06.07.2022 19:45

Great content!

Ответить
@martinkristoffersson9495
@martinkristoffersson9495 - 04.07.2022 11:56

Great video! Please don't use vocals in your background music. It makes it sometimes hard to focus on what you are saying.

Ответить
@goffy0101
@goffy0101 - 28.06.2022 20:52

why are you talking about class components still?

Ответить
@cas6112
@cas6112 - 03.06.2022 08:24

Thank you so much for the content. Really improved my understanding of the react features.

Ответить
@daileybailey5003
@daileybailey5003 - 03.05.2022 12:51

Thanks!!

Ответить
@devislight
@devislight - 01.05.2022 17:43

Thank you so much 👨‍🏫🙋‍♂️

Ответить
@drphil2424
@drphil2424 - 29.04.2022 15:08

PAPA SONNY WE LOVE YOU

Ответить
@frogonajetski
@frogonajetski - 25.03.2022 19:37

This is THE best video explanation I have seen on this. Thank you so much. I totally understand now.

Ответить
@salarhashemian3436
@salarhashemian3436 - 09.03.2022 06:57

Keep up the good work man
this video was really help full

Ответить
@godfataliti
@godfataliti - 08.03.2022 20:23

Agradecido con el de arriba 😊

Ответить
@0073988
@0073988 - 04.03.2022 03:51

Son Heung Min!

Ответить
@dipanjandas9463
@dipanjandas9463 - 26.02.2022 14:11

Create a video about login form in React js.

Ответить
@Bannords
@Bannords - 08.02.2022 01:07

Ты крутой, спасибо! I mean you are super rockstar)) thanks for guide)

Ответить
@juhiojha2050
@juhiojha2050 - 05.02.2022 04:50

your videos have so clearty..........your videos are amezing .......... :)

Ответить
@zstudio6127
@zstudio6127 - 27.01.2022 15:22

Boom Sony!!.. Love from BD

Ответить
@eyoeltekle
@eyoeltekle - 20.01.2022 13:22

What a nice tutorial bro, I was struggling to understand this concept because most tutorials use complex examples this though was brilliant, tnxs

Ответить
@kushagraagnihotri8516
@kushagraagnihotri8516 - 14.01.2022 12:58

how to use arrays in state?

Ответить
@srinivasaraoyp3640
@srinivasaraoyp3640 - 12.01.2022 17:54

Very interesting video. Thank you.

Ответить
@juansebastianvalenciajimen2751
@juansebastianvalenciajimen2751 - 15.12.2021 04:05

Try to maintain your custom hooks very simple, without much logic.

Ответить
@juansebastianvalenciajimen2751
@juansebastianvalenciajimen2751 - 15.12.2021 04:02

Remember guys that we can create our hooks called custom hooks, these custom hooks help us to share the logic for differents components

Ответить
@juansebastianvalenciajimen2751
@juansebastianvalenciajimen2751 - 15.12.2021 03:58

Sonny great intro that you have bro

Ответить
@markj.voltaire5620
@markj.voltaire5620 - 03.12.2021 22:33

great explanation

Ответить
@enfieldli9296
@enfieldli9296 - 22.11.2021 12:11

State is the react way of definning variable, this is so refreshing!

Ответить
@lexsemenenko7044
@lexsemenenko7044 - 18.11.2021 20:37

What's a good way to update a nested property of an object in useState? My state stores an object with a property that holds an array. I need to update array items. The way I am doing it now is to clone the whole object, do the update, and then put the whole updated object back into useSate. Appreciate!

Ответить
@mkilphewer2425
@mkilphewer2425 - 18.11.2021 14:47

Iam a newbie

The doubt i have is,in this video when u created a class based component and then import it in index.js..what u did is import app from (its location)...but the name of the component was not app right?..it was "appclass"..then how did it display it in the browser without any error..and even when u render the component in index.js..u simply wrote <app />..shouldn't it be <appclass /> ?

Iam totally a beginner..need help

Ответить
@nimasherpa8608
@nimasherpa8608 - 31.10.2021 20:03

Your videos are awesome

Ответить
@parseltongue6567
@parseltongue6567 - 07.10.2021 07:59

Great teacher. This guy is official!

Ответить
@pawanbhatt3847
@pawanbhatt3847 - 23.09.2021 20:00

Nice sir

Ответить
@deepaknegi4317
@deepaknegi4317 - 21.09.2021 20:58

Hello, could you explain how to update multiple state variables depending on one another in functional Components like in-class components we can pass back a callBack to this.setState, we callback will update the state after it.


in class component-->
this.state ={count:0,ans:1}
this.setState((prev)=>{return {...prev, count : count+1}},(prev)=>{return {...prev, ans: count * 2}});
in this way first "count" will be updated and then "ans" will be updated. How to achieve the same with functional
components.



in functional component-->
const [count, setCount] = useState(0);
const [ans, setAns] = useState(1);

setCount(prev=>prev+1);
setAns(prev=>count * 2);
but as state updation is an async process then "setAns" could have old value of "count" i.e 0;

Ответить
@bikramrumba3463
@bikramrumba3463 - 20.09.2021 21:27

I truly appreciate you for being there. Keep rocking!!

Ответить
@aryansethi7069
@aryansethi7069 - 17.09.2021 15:38

I saw you teaching clever programmer then came to your channel lol

Ответить