React Interview Questions | Beginner to Advanced

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

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

  • @PedroTechnologies
    @PedroTechnologies  7 месяцев назад +1

    To try everything Brilliant has to offer-free-for a full 30 days, visit brilliant.org/PedroTech . You’ll also get 20% off an annual premium subscription.

    • @godofwar8262
      @godofwar8262 7 месяцев назад +1

      Bro please start backend series by covering topic like node js for beginners to advanced i had learn front-end from you please start backend

  • @xyves6327
    @xyves6327 7 месяцев назад +11

    1. First question Use the provided input field, display filtered list of items when typing that match typing 3:45
    2. Second question 12:40
    3. Third question 18:40

  • @williamrinaldi1808
    @williamrinaldi1808 7 месяцев назад +17

    Why set state for the search term? You can just set filtered fruits state in handle input function and filter using the event target value.

    • @maheshshirsat9075
      @maheshshirsat9075 Месяц назад

      Depends on our choice both are ok

    • @johnddonnet5151
      @johnddonnet5151 Месяц назад

      @@maheshshirsat9075 Event target value is better as it can be easily transalated to other frameworks, which shows that you understand that codebases are not forever.

  • @edrtjiud7752
    @edrtjiud7752 День назад +1

    Observation for the debounce hook - the timer clean up in useEffect is the hole key (not just for memory leaks), without it you don't reset the timer on each new text, you will just delay all the text's changes being returned.

  • @foysalmohammad3278
    @foysalmohammad3278 5 месяцев назад +13

    Good video with nice explanation.
    I think two states are not necessary. You can Just use one useState variable to store onchange value of input element, and then filter
    like this: const filteredFruits = fruits.filter((fruit) =>
    fruit.toLowerCase().includes(typedFruits.toLowerCase())
    );
    And render filteredFruits

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

      yes , i was having the same question

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

      This was my approach too, and it worked perfectly

  • @mkum2141
    @mkum2141 7 месяцев назад +10

    why do we need to create fruitData state in question 1? Can't we just filter the original fruits array based on the search term state? Eveytime the user types in a new search term the component will rerender and this refilter the data - doesn't seem like we need the additional state for the fruit

    • @setasan
      @setasan 7 месяцев назад +2

      Yeah i thought the same lol

    • @PranshuSahu-pl7gx
      @PranshuSahu-pl7gx 7 месяцев назад

      no we cannot do so. state is necessay as whenever there is change in state , new dom will painted in screen.

    • @mkum2141
      @mkum2141 7 месяцев назад +2

      @@PranshuSahu-pl7gx yes, but we only need to change the fruit when the searchTerm changes.
      When the serchTerm changes, the component will rerender and the the fruits will be filtered using the new search term.
      If you actually look at the code we aren't doing anything with the fruitData state other than initialising.
      Try implementing this yourself and youll see you only need the search term state and the fruit state. You can directly filter the fruits array on each render using the search term state.

  • @calvinputera2504
    @calvinputera2504 7 месяцев назад +2

    thank's for your content about React I learned a lot from your videos.. because of that I was able to get a job as frontend developer now I have been in this career for about 3 years.. you have changed my life..
    keep uploading your videos because many people who have been helped because of this..
    greetings from Indonesia 👋

  • @akhilkumarsingh5041
    @akhilkumarsingh5041 4 месяца назад +6

    The third Qs can be solve like this as well!! am I correct
    import React from 'react'
    import { useState } from 'react'
    const PhoneNum = () => {
    const [phone, setphone] = useState("");
    const handleInputChange=(e:any)=>{
    let value = e.target.value;
    let numericValue = value.replace(/[^0-9]/g, "");
    if (numericValue.length > 3) {
    numericValue = `(${numericValue.slice(0, 3)})-${numericValue.slice(3)}`;
    }
    setphone(numericValue);
    }
    return (

    PhoneNum


    )
    }
    export default PhoneNum

  • @ugogalliano1176
    @ugogalliano1176 7 месяцев назад +11

    Where is the github repo ?

  • @dngathondu
    @dngathondu 2 месяца назад +1

    For the 3rd question, the following code worked for me
    ```import { useState } from "react";
    export default PhoneNumber = ({ maxLength = 10 }) => {
    const [input, setInput] = useState("");
    const handleInputChange = (e) => {
    const numbers = e.target.value.replace(/[^0-9]/g, "");
    const size = numbers.length;
    if (size > maxLength) return;
    if (size > 3 && size 3 && size > 6) {
    setInput(
    `(${numbers.slice(0, 3)}) ${numbers.slice(3, 6)} - ${numbers.slice(6)}`
    );
    } else {
    setInput(numbers);
    }
    };
    return (

    );
    };```

  • @raviel_0422
    @raviel_0422 7 месяцев назад +1

    Hello Pedro. Congratulations on 200k subscribers. You deserved it man, I learned a lot of React from you.

  • @teodordimitrov7062
    @teodordimitrov7062 18 дней назад

    Good video. I think you don't need a state for "fruitsData" in the first question because you never used the corresponding update (set) function. Instead you can use the fruits constant outside the main function and use it for filtering the fruits. Am I right?

  • @naveenbasyal001
    @naveenbasyal001 6 месяцев назад +2

    1st and 2nd is pretty nice and easy, which we use on daily basis but the 3rd one is definitely the trickiest one, although we mostly use libraries for this but it's better to understand how things are working, we'll surely gonna forget the logic in future even if we try to do it from scratch .

  • @lucasrmendonca
    @lucasrmendonca 2 месяца назад

    Hi Pedro, doesnt the native html tag already provide this filtering functionality?

  • @KatiaZanotti-g1g
    @KatiaZanotti-g1g 4 месяца назад

    in the phone input you have to manage the user backspace after the "-" or the ")" now there is an error and the cursor goes back to the end of the input

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

    Hello Pedro. Your videos are very instructive. I’ve learn a lot with them. I would like to ask you for a video where you implement & explain the search functionality in a MERN scenario with redux toolkit for state. Thanks a million for your hard work.

  • @deadb1t
    @deadb1t 7 месяцев назад +1

    Thx for sharing this knowledge with us Pedro!

  • @adududuke3995
    @adududuke3995 2 месяца назад

    Nice content. What is the music playing after the intro ?

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

    with this search question can you do a video on how to do client side search/filtering and server side search in react.

  • @godofwar8262
    @godofwar8262 7 месяцев назад +6

    Bro please start backend series by covering topic like node js for beginners to advanced i had learn front-end from you please start backend

    • @regilearn2138
      @regilearn2138 7 месяцев назад +1

      With typescript it would be better

    • @godofwar8262
      @godofwar8262 7 месяцев назад +1

      @@regilearn2138 yeah it will be cherry on the top also if he make a video on typescript before this Crouse just a crash course would be great

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

      Just learn by yourself

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

    Great video for interview confidence. I owe you!

  • @fabricator.cap.hill.seattle
    @fabricator.cap.hill.seattle 6 месяцев назад

    Great variety! 2 and 3 are on my to do list.

  • @ihebbenaicha1353
    @ihebbenaicha1353 7 месяцев назад +4

    where is the github repo bro ?

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

    This video is a very useful for me now. Thanks a lot )

  • @powercircuitacademy
    @powercircuitacademy 7 месяцев назад +1

    Congratulations🎉 200k

  • @samialvi4226
    @samialvi4226 6 месяцев назад

    Please make a series on it!!!!

  • @8888-t4d
    @8888-t4d 7 месяцев назад

    Hi my brother, l have problem about react can you explain how can l make twitter setting page pc and mobile responsivibility?

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

    Please make a microservice project using Mern

  • @richardc2726
    @richardc2726 21 день назад

    I got over 3 mins in and realised this was just going to be a long advert for the sponsors. Don’t waste your time folks as there are React interview videos out there that actually cover - well you know React interviews.

    • @PedroTechnologies
      @PedroTechnologies  20 дней назад

      Well, the advert lasts only 40 seconds, the rest of the vide is not an ad...

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

    Nice video, how old are you Pedro?

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

    this is cool bro

  • @Misica11000
    @Misica11000 7 месяцев назад +3

    Second task is much more complicated with that useeffect shit,why,just why programing couldnt be simplier?...These are examples why people quit programing.....😢😢😢😢

  • @g-g-9
    @g-g-9 2 месяца назад

    Great coding by using just 1 eye

  • @Bruno_Corso
    @Bruno_Corso 7 месяцев назад +1

    Are you brazilian? Ótimo conteduo

  • @gawolimgexige
    @gawolimgexige 7 месяцев назад +1

    Congress 200k

  • @viveksah2069
    @viveksah2069 4 месяца назад +1

    This is pathetic it’s showings you don’t have the basic understanding of react it can be done only one function by useing useMemo with filter why do you need so many use effects and const

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

      loll i have 6 years of react job experience, ofc i don't have a basic understanding of it...

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

      @@PedroTechnologies then you have bad experience need to educate yourself

  • @faustozambrano4901
    @faustozambrano4901 5 месяцев назад

    3 minutes just for vanter....Nice