React tutorial in Hindi #18 Conditional rendering | If Condition

Поделиться
HTML-код
  • Опубликовано: 4 ноя 2024

Комментарии • 68

  • @anonymousbrand8819
    @anonymousbrand8819 4 года назад +20

    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 😊😊

  • @vaibhavdubey2836
    @vaibhavdubey2836 Год назад +5

    every head must bow to this king👑

  • @ZahidKhan-th8pz
    @ZahidKhan-th8pz 3 года назад +2

    Chalega sir kyuki variable me value assign krke sirf match krana h so it will execute without any errors
    const loggedIn=1;

  • @meghana3005
    @meghana3005 2 года назад +4

    yes, it works for the variable

    • @ashutoshpatel5030
      @ashutoshpatel5030 Год назад

      Exactly but we can't change and acces its value dynamically thats why we use state!!😄😄

  • @RadheyNameKaSahara
    @RadheyNameKaSahara 8 месяцев назад

    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

  • @infotainment4327
    @infotainment4327 9 месяцев назад

    Very nice explanation sir ❤
    And yes it works for variable too.

  • @madhavidubey6411
    @madhavidubey6411 2 года назад +3

    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?

    • @ashujha9072
      @ashujha9072 2 года назад

      Thanku thanku

    • @ashurajput357
      @ashurajput357 Год назад +1

      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

    • @patelakash6484
      @patelakash6484 Год назад

      😜

  • @faizahmed688
    @faizahmed688 2 года назад

    usestate ke jagha par koi or var bhi lenge toh chalega q ke hum ne pahle hi upar import kar diya na

  • @codingssprint7362
    @codingssprint7362 3 года назад +2

    const loggedin =1 karate hai to chalata hai par variable ko update nai kar sakate function components me

  • @ABadini389
    @ABadini389 2 года назад

    mashallah both he great sir oh app .

  • @faizahmed688
    @faizahmed688 2 года назад

    sir I like to your teaching way.
    thank you so much sir ❤❤❤

  • @sapnakumari6011
    @sapnakumari6011 4 месяца назад

    yes we can use with variable (let logged = 1) like this

  • @Meh-vt4xw
    @Meh-vt4xw 2 года назад +1

    commenting for the algorithm 👍

  • @mayurchaudhari4239
    @mayurchaudhari4239 7 месяцев назад

    sir hum bigineers hai AI ke karan hume job milegi ki nahi .kya hame padhayi chod deni chahiye

  • @shivamchawda8203
    @shivamchawda8203 3 года назад +3

    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?

  • @sarwanverma148
    @sarwanverma148 3 года назад

    Thanks For this video, Kya ham bina react ko import kiye useState ko import kar sakte hai??

  • @RahulVerma-br6bx
    @RahulVerma-br6bx 2 года назад

    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

  • @hanumantbangar8952
    @hanumantbangar8952 3 месяца назад

    Hi Sir,
    How to use switch statement in react js.

  • @RiyazBaig-yq9fy
    @RiyazBaig-yq9fy Год назад

    hlo brother hme if or else condition button k upr lagana hai

  • @faizahmed688
    @faizahmed688 2 года назад

    sir ek query hai sir fir else ka output kaise aayega

  • @ompawar4350
    @ompawar4350 Год назад

    Thank You for this playlist

  • @AmanTeach
    @AmanTeach 2 года назад

    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???

    • @Justkidding-lt5ns
      @Justkidding-lt5ns 4 месяца назад

      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

  • @devinderkumarpandey1215
    @devinderkumarpandey1215 Год назад

    Some in return method end() contain semi colon and sometimes not. Please reply

    • @divyanshsinghbhati6026
      @divyanshsinghbhati6026 Год назад

      ; 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!

  • @getsetalk
    @getsetalk 2 года назад

    Bilkul chalega sir

  • @shorttutorials205
    @shorttutorials205 Год назад +2

    yeah we can use variable for conditional redering
    ex: let v =1;
    {v===1?'first':v===2?'second':'third'}

  • @ZahidKhan-th8pz
    @ZahidKhan-th8pz 3 года назад +2

    Sbse achi baat inke video me kya hoti h koi bata skta h ??

    • @nikhilflautist
      @nikhilflautist 3 года назад +7

      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.

    • @codestepbystep
      @codestepbystep  3 года назад +2

      Thank you 🙂

  • @MaryamKhan-nn5gh
    @MaryamKhan-nn5gh Год назад

    nai chlay ga state ki jaga varibale ku ek react mai state use hute hai bar bar update krny k leye

  • @SarojKumar-zt8lg
    @SarojKumar-zt8lg Год назад +1

    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;

  • @digvijaybind
    @digvijaybind 2 года назад

    Bro you not using setloggin of usestate

  • @vikaskashyap7500
    @vikaskashyap7500 Год назад

    if we use normal variable instead useState then it will not work

  • @SantoshSingh-mo8mr
    @SantoshSingh-mo8mr 3 года назад +1

    if we define let only one condition is true otherwise showing error

  • @apekshahande3544
    @apekshahande3544 2 года назад

    it will work properly

  • @RahulSharma-wh8sq
    @RahulSharma-wh8sq 2 года назад

    Great!

  • @coder-cc4pd
    @coder-cc4pd 7 месяцев назад

    yes we can use varaible without make useState on multiple condition , but this is not good approach

  • @rubinshaikh6759
    @rubinshaikh6759 3 года назад +5

    plzz make a video on remaining all the operators [ && , || , ? , ! , == ,=== , : ] it will be very help for us sir

  • @bhupendrabalapure3059
    @bhupendrabalapure3059 2 года назад

    sir please role-based login btaiye na react-laravel main

  • @ojhalpatkar963
    @ojhalpatkar963 3 года назад

    Thank you

  • @hmfakhirisrar2789
    @hmfakhirisrar2789 Год назад

    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

    • @mdabidkalam3527
      @mdabidkalam3527 Год назад +1

      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}
      )
      };

    • @hmfakhirisrar2789
      @hmfakhirisrar2789 Год назад

      @@mdabidkalam3527 Thank u 💗

  • @FullMovie_Official
    @FullMovie_Official Год назад

    thanks

  • @syedmubeen8082
    @syedmubeen8082 Год назад

    nice

  • @AnkitRajput-kl4sb
    @AnkitRajput-kl4sb 2 года назад

    good

  • @utkarshshinde2758
    @utkarshshinde2758 3 года назад

    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.

  • @DhrubKumarSharma-r9e
    @DhrubKumarSharma-r9e 2 месяца назад

    Ternary operator

  • @harshrana5050
    @harshrana5050 2 года назад +1

    10

  • @digvijaybind
    @digvijaybind 2 года назад

    So it's sending error

    • @apekshahande3544
      @apekshahande3544 2 года назад +1

      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

    • @meetgoswami9116
      @meetgoswami9116 2 года назад

      @@apekshahande3544 Thank you so much

  • @dagamer7272
    @dagamer7272 3 года назад

    thanks sir! ('_')