React tutorial in Hindi #12 State with class component

  Рет қаралды 91,448

Code Step By Step

Code Step By Step

Күн бұрын

Пікірлер: 58
@kirtisoni21
@kirtisoni21 Жыл бұрын
Thanks a lot sir, I have learned many things.
@fatemapatel9122
@fatemapatel9122 3 жыл бұрын
No, we can't use useState in class-component because, useState is a Hook and Hooks are not implement in class-component.
@jawadullah4685
@jawadullah4685 2 жыл бұрын
Right
@khyzersaleem
@khyzersaleem 7 ай бұрын
React Class Components have built in State Object. You might have noticed that we used state earlier in the component constructor section. The state object is where you store property values that belongs to the component. When the state object changes, the component re-render. ONLY call useState() hooks inside a functional component: Hooks are created for functional components and should only be used in functional components. They don't work in class components. If you need to use state in the class component, then use the state object.
@nabilalakhani4182
@nabilalakhani4182 3 жыл бұрын
ur videos are ultimate keep up the good work thanks
@mshahdevs
@mshahdevs 2 ай бұрын
No, you cannot use the useState hook in class components in React. The useState hook is a feature of React functional components introduced with hooks in React 16.8.
@subhendu2134
@subhendu2134 4 ай бұрын
In React, state is not public, state is private to the component in which it is defined. This means that the state is not accessible or modifiable by other components directly.
@harmankaur3359
@harmankaur3359 Жыл бұрын
clearly explained!
@shoaib4x533
@shoaib4x533 2 жыл бұрын
Maza aagya sir 🔥🔥
@saurabhmore5164
@saurabhmore5164 3 жыл бұрын
Can we only define the state without giving any value or data?
@ZahiidKhan262
@ZahiidKhan262 3 жыл бұрын
Yes empty
@prosinging7853
@prosinging7853 2 жыл бұрын
this.setState is onestep behind. tried with await in SetState but that also not working. what might be wrong.When I am testing api with postman .Getting proper result but at the time of SetState it is one step behind when I console warn after assigning state
@khyzersaleem
@khyzersaleem 7 ай бұрын
Use Arrow Function In OnClick Then Use this.setState
@Pragya_Empower_Studies
@Pragya_Empower_Studies 2 ай бұрын
Thank you.............
@ricky_una_16
@ricky_una_16 Жыл бұрын
Sir I have a small doubt regarding state, apne bola state public hai but google mai private show kr raha hai. So which one is correct, please clear it. Anyone also can verify me about this doubt.
@mohitpipaliya2594
@mohitpipaliya2594 Жыл бұрын
In React, state can be either public or private. Public State: Public state refers to the state that is accessible and modifiable from outside the component. It's typically used when the state needs to be shared across multiple components or when you want to update the state from a parent component. Public state is managed using the props system, where a parent component passes down state as props to its child components. This makes the state public and accessible to those child components. Private State: Private state refers to the state that is local and specific to a component. It's not directly accessible or modifiable from outside the component. Private state is managed using the useState or other state management tools within the component. It's used when you want to keep the state isolated to a specific component and avoid unintended interactions with other components. let me know if you still don't understand, I'll give you code example for better understanding
@fea25akshaygirase79
@fea25akshaygirase79 Жыл бұрын
op lecture sir
@navjyotyadav4053
@navjyotyadav4053 9 ай бұрын
Is state public or private? you said, its public then we should be able to use it outside of component. And also you said, state can not be used outside the component. These two statements conflicts each other. I think state in react is private, not public. what do you think? Please reply here.
@kevalhirpara6747
@kevalhirpara6747 7 ай бұрын
bhai google me state private dikha rahi he
@DeepakGupta-hj2dv
@DeepakGupta-hj2dv 4 жыл бұрын
Redux ke video kab aayege?
@himanshuchauhan6520
@himanshuchauhan6520 3 жыл бұрын
if i am using 2 this.state in the constructor() like this constructor() { super(); this.state={data:"Himanshu"} this.state={number:1} } but i am not getting any output on the browser until i click the button return ( {this.state.data} {this.state.number} this.Inc()}>Surname ); Can you tell me why ?
@ChandanSingh-ww5hr
@ChandanSingh-ww5hr 2 жыл бұрын
@himanshuchauhan6520 bro you don't need to create a separate state just put all the state data together like this super(); this.state={data:"Himanshusu", number:1} this will work
@ashurajput357
@ashurajput357 Жыл бұрын
​@@ChandanSingh-ww5hr yes because mentioning this.state two times is wrong because now they are now different objects.
@ZahiidKhan262
@ZahiidKhan262 3 жыл бұрын
Sir state private hoti h na usko as a argument use krte h hm log dusre components me
@tejasdeore8340
@tejasdeore8340 2 жыл бұрын
No state public hoti h previous video me bataya h
@apkaChotaBhai
@apkaChotaBhai 3 жыл бұрын
Bhai very gud yaar, thanks bade bhai Bss insta pe msg ka reply kar diya karo, and video me 5-7 min leke css ko bhi re-render karke dikha diya karo bhai
@sachindandge764
@sachindandge764 2 жыл бұрын
Hello sir i have been watching your this series but it seems to me difficult as I am a beginner.plz make a videos of react which will have small code snippets as an examples to understand it better..
@frontendwale
@frontendwale 2 жыл бұрын
Hi Sachin, you may try to look on this kzbin.info/door/jL4SPbBlJoOKT_YZz6zISQ
@tanmayhedau5342
@tanmayhedau5342 2 жыл бұрын
u should have basic knowledge of html n css that's it and javascript too
@harshitrathi3077
@harshitrathi3077 4 жыл бұрын
Thankyou Bro
@codestepbystep
@codestepbystep 4 жыл бұрын
welcome
@shubhamkurulekar4551
@shubhamkurulekar4551 3 жыл бұрын
states are public ?is it right?i think private is right
@tejasdeore8340
@tejasdeore8340 2 жыл бұрын
He mentioned in his previous video that state is public
@nileshgore4790
@nileshgore4790 2 жыл бұрын
yes bro I also think state is private
@WebDeveloper831
@WebDeveloper831 9 ай бұрын
Sir apne bola he ke state public hote hy lekin chatgpt to private btaa rhee he ap ye confirm kar den...
@nikhilgaming4147
@nikhilgaming4147 2 жыл бұрын
No,we can't use hooks inside the class component
@test-k5i
@test-k5i 3 жыл бұрын
Sir why we are not use function keyword in that case
@roshanpandey4041
@roshanpandey4041 Жыл бұрын
how state is public ?
@Ayush37262
@Ayush37262 Жыл бұрын
State is private
@sanketdeogade4490
@sanketdeogade4490 2 жыл бұрын
How to update state immediately using class component? Because whenever I try to do setState, it doesn't update immediately. We can use useEffect in functional components But what about class components? How can we do it?
@aashitkumarsinha3459
@aashitkumarsinha3459 2 жыл бұрын
use componentDidMount life cycle
@sanketdeogade
@sanketdeogade 2 жыл бұрын
@@aashitkumarsinha3459 How to make it work for last update of setState?
@aashitkumarsinha3459
@aashitkumarsinha3459 2 жыл бұрын
@@sanketdeogade it get automatically render at time of states get loaded first time, but it also get called by React...when the state gets changes...
@abhisheksinghtomar159
@abhisheksinghtomar159 3 жыл бұрын
Why we can't use this.apple here?
@shaheenkhan6313
@shaheenkhan6313 4 жыл бұрын
I think no we cannot use useState in class component because it gives error
@codestepbystep
@codestepbystep 4 жыл бұрын
Right
@ayaankh245
@ayaankh245 3 жыл бұрын
because it is hook. Hooks are for function components only.
@syedateeq1602
@syedateeq1602 3 жыл бұрын
we can use it example. const [state, setState] = useState({ count: 0 }); console.log(state.count); and update it like this setState({ count: state.count + 1 });
@riteshgoswami1596
@riteshgoswami1596 3 жыл бұрын
hook in only for function component
@riderzzone6373
@riderzzone6373 Жыл бұрын
laptop me charge bhi diya karo sir 🤣🤣
@codestepbystep
@codestepbystep Жыл бұрын
Haha
@GautamKumar_39
@GautamKumar_39 Жыл бұрын
STATE IS PRIVATE, NOT PUBLIC
@JavedAli-n7p7r
@JavedAli-n7p7r 8 ай бұрын
itna bareek kar rakha text dikh bhi ni raha
@anupriya4113
@anupriya4113 Жыл бұрын
state is private not public
@coder-cc4pd
@coder-cc4pd 9 ай бұрын
ONLY call useState() hooks inside a functional component: Hooks are created for functional components and should only be used in functional components. They don't work in class components
@jawadullah4685
@jawadullah4685 2 жыл бұрын
No Nahe
@dawoodatif3397
@dawoodatif3397 2 ай бұрын
Ap non muslim hu ❤
React tutorial in Hindi #13 Props with functional component
13:54
Code Step By Step
Рет қаралды 117 М.
React tutorial in Hindi #11 State with functional component
11:38
Code Step By Step
Рет қаралды 138 М.
小丑女COCO的审判。#天使 #小丑 #超人不会飞
00:53
超人不会飞
Рет қаралды 16 МЛН
My scorpion was taken away from me 😢
00:55
TyphoonFast 5
Рет қаралды 2,7 МЛН
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Lifecycle Methods in React | The Complete React Course | Ep.48
31:18
Anurag Singh ProCodrr
Рет қаралды 6 М.
Function Component and Class Component in React JS (Hindi)
24:03
Geeky Shows
Рет қаралды 63 М.
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 854 М.
ReactJS Tutorial - 8 - Class Component - Rules of Hooks ✌️
9:10
Technical Suneja
Рет қаралды 27 М.
React Lifecycle Methods Explained | Part -1 - Mounting
16:29
Sofia Goyal
Рет қаралды 18 М.
React tutorial in Hindi #14 Props in class component
13:19
Code Step By Step
Рет қаралды 74 М.