Fabulous explanation bro 😊😊😊 complet youtube me itni sahi explanation nhi mili conditions statement pe . Sab gol gol ghumate ha. Thx bro it’s very helpful for me 😊😊
hi sir, i am following your videos, yes i can understand you concept, but i have few query in react, so may i know could you provide the coaching also ?? if yes please do let me know.. thanks
Hello, Thankyou so much for the great explaination of all the topics... But in this topic I have a query... That we use else if condition so why we are changing the state like 1,2,3? Is there any other common way to use that?
Because Ternary operator or conditional rendering is a shortcut way to use instead of if/else or else if loop so on changing state different users will be there in output
What is the purpose of defining "setLoggedIn" here. If you are mutating the variable value below directly by using loggedIn state . it is clearly visisble that that setLoggedIn is defined here but never used. We can't mutate the variable directly we always have to use the copy of it ie- setLoggedIn in this case. small query please help?
sir how this conditional rendering be executed via button like if i press buton user1 comes then next click user2 and so on like toggle can we render this
Hello sir yeh hum useState me default value pass kr rahe hai uska ass a input box ke thro pass kr sakte hai then submit button se sumbit krne ke baad yeh show kare ki user 1login hai ya 2 login hai other wise jo bhi ho???
Sir conditional rendering bata rhe hai, to wo User 1,2 3 ye example hai naki variable. Try to understand the intention. And apka bataya technique bhi sahi hai
; colon is to terminate the fn, up to me every time we return we should terminate it. by default, you forget to write colon at the end of the return it considers terminated!
1. Only padhai, No bakwas. 2. Pehle Theory ki kya hoga video mein, then us se related code, then usko explain krna ki aisa kyu hua??. 3. Can't skip any second as every second is related to concept only.
conditional operator using state // import './App.css'; import {useState} from 'react' function Profile() { const[loggedIn, setLoggedIn]=useState(2) return(
{setcheck_1(e.target.checked)}}/>checked for log in {setcheck_2(e.target.checked)}}/>checked for log in {setcheck_3(e.target.checked)}}/>checked for log in {check_1==true?Walcome user_1: check_2==true?Welcome user_2: check_3==true?welcome user_3: Welcome guest}
you used a conditional (ternary) operator which we used in PHP as well instead of if-else Actually, it's also a Javascript operator not specific to react.
Fabulous explanation bro 😊😊😊 complet youtube me itni sahi explanation nhi mili conditions statement pe . Sab gol gol ghumate ha. Thx bro it’s very helpful for me 😊😊
welcome bro
sahi hai bro ... sath me interview question maja aata hai
every head must bow to this king👑
Chalega sir kyuki variable me value assign krke sirf match krana h so it will execute without any errors
const loggedIn=1;
yes, it works for the variable
Exactly but we can't change and acces its value dynamically thats why we use state!!😄😄
hi sir, i am following your videos, yes i can understand you concept, but i have few query in react, so may i know could you provide the coaching also ?? if yes please do let me know.. thanks
Very nice explanation sir ❤
And yes it works for variable too.
Thanks and welcome
Hello,
Thankyou so much for the great explaination of all the topics...
But in this topic I have a query...
That we use else if condition so why we are changing the state like 1,2,3? Is there any other common way to use that?
Thanku thanku
Because Ternary operator or conditional rendering is a shortcut way to use instead of if/else or else if loop so on changing state different users will be there in output
😜
usestate ke jagha par koi or var bhi lenge toh chalega q ke hum ne pahle hi upar import kar diya na
const loggedin =1 karate hai to chalata hai par variable ko update nai kar sakate function components me
mashallah both he great sir oh app .
sir I like to your teaching way.
thank you so much sir ❤❤❤
yes we can use with variable (let logged = 1) like this
commenting for the algorithm 👍
sir hum bigineers hai AI ke karan hume job milegi ki nahi .kya hame padhayi chod deni chahiye
What is the purpose of defining "setLoggedIn" here. If you are mutating the variable value below directly by using loggedIn state . it is clearly visisble that that setLoggedIn is defined here but never used. We can't mutate the variable directly we always have to use the copy of it ie- setLoggedIn in this case. small query please help?
I was thinking same
Thanks For this video, Kya ham bina react ko import kiye useState ko import kar sakte hai??
No
sir how this conditional rendering be executed via button like if i press buton user1 comes then next click user2 and so on like toggle can we render this
Hi Sir,
How to use switch statement in react js.
hlo brother hme if or else condition button k upr lagana hai
sir ek query hai sir fir else ka output kaise aayega
Thank You for this playlist
Hello sir yeh hum useState me default value pass kr rahe hai uska ass a input box ke thro pass kr sakte hai then submit button se sumbit krne ke baad yeh show kare ki user 1login hai ya 2 login hai other wise jo bhi ho???
Sir conditional rendering bata rhe hai, to wo User 1,2 3 ye example hai naki variable. Try to understand the intention.
And apka bataya technique bhi sahi hai
Some in return method end() contain semi colon and sometimes not. Please reply
; colon is to terminate the fn, up to me every time we return we should terminate it. by default, you forget to write colon at the end of the return it considers terminated!
Bilkul chalega sir
yeah we can use variable for conditional redering
ex: let v =1;
{v===1?'first':v===2?'second':'third'}
Thanks
Sbse achi baat inke video me kya hoti h koi bata skta h ??
1. Only padhai, No bakwas.
2. Pehle Theory ki kya hoga video mein, then us se related code, then usko explain krna ki aisa kyu hua??.
3. Can't skip any second as every second is related to concept only.
Thank you 🙂
nai chlay ga state ki jaga varibale ku ek react mai state use hute hai bar bar update krny k leye
conditional operator using state
// import './App.css';
import {useState} from 'react'
function Profile()
{
const[loggedIn, setLoggedIn]=useState(2)
return(
{
loggedIn===1?welcome anil:loggedIn===2?welcome rahul:welcome guest
}
)
}
export default Profile;
Bro you not using setloggin of usestate
if we use normal variable instead useState then it will not work
if we define let only one condition is true otherwise showing error
it will work properly
Great!
yes we can use varaible without make useState on multiple condition , but this is not good approach
plzz make a video on remaining all the operators [ && , || , ? , ! , == ,=== , : ] it will be very help for us sir
sir please role-based login btaiye na react-laravel main
Thank you
import React, { useState } from 'react'
const IF_ELSE_COND = () => {
// const [Login , setLogin ] = useState(true)
const[check_1,setcheck_1]=useState(false)
const[check_2,setcheck_2]=useState(false)
const[check_3,setcheck_3]=useState(false)
return (
{setcheck_1(e.target.checked)}}/>checked for log in
{setcheck_2(e.target.checked)}}/>checked for log in
{setcheck_3(e.target.checked)}}/>checked for log in
{check_1==true?Walcome user_1:
check_2==true?Welcome user_2:
check_3==true?welcome user_3:
Welcome guest}
)
}
export default IF_ELSE_COND
A little enhancement to your code,
export function IF_ELSE_COND() {
// const [Login , setLogin ] = useState(true)
const [check_1, setcheck_1] = useState(false)
const [check_2, setcheck_2] = useState(false)
const [check_3, setcheck_3] = useState(false)
return (
{ setcheck_1(e.target.checked); setcheck_2(false); setcheck_3(false) }} />User1
{ setcheck_2(e.target.checked); setcheck_1(false); setcheck_3(false) }} />User2
{ setcheck_3(e.target.checked); setcheck_1(false); setcheck_2(false) }} />User3
{check_1 == true ? Walcome user_1 :
check_2 == true ? Welcome user_2 :
check_3 == true ? welcome user_3 :
Welcome guest}
)
};
@@mdabidkalam3527 Thank u 💗
thanks
nice
Thanks
good
you used a conditional (ternary) operator which we used in PHP as well instead of if-else Actually, it's also a Javascript operator not specific to react.
does he said it is specific to react?
Ternary operator
10
So it's sending error
import React from "react";
function Profile() {
let loggedIn =3;
return (
{loggedIn == 1 ? (
Welcom Guest 1
) : loggedIn == 2 ? (
Welcom Guest 2
) : (
Welcom Guest {loggedIn}
)}
);
}
export default Profile;
Try this using variable , it will not give error
@@apekshahande3544 Thank you so much
thanks sir! ('_')