React.js TypeScript Conditional Props - Props that depend on other Props

แชร์
ฝัง

ความคิดเห็น • 168

  • @Burn0u7
    @Burn0u7 3 ปีที่แล้ว +32

    I saw link to this video from Reddit. I hasn't seen anyone explain so well advanced typescript concepts in a while! This video is like the best half hour I've spend in a while in this pandemic. I think every library developer should know this usage of generic and discriminated unions.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +7

      Your comment means soo much to me. I don't think I can put to words the happiness I felt waking up this morning to your comment, I'm speechless!!! You are amazing!!
      Thank you soo sooo much for your wonderful words my friend 😍😍😍

    • @Aranueth
      @Aranueth 3 ปีที่แล้ว +3

      That;s the most amazingly honest review I've read in a while, I'll definitely give this a look.

  • @konar7466
    @konar7466 2 ปีที่แล้ว +2

    Thank You Bruno for this great video. I learned something from it! Very good explanation :)

  • @sergioramos0709
    @sergioramos0709 3 ปีที่แล้ว +10

    Finally TypeScript Conditional Props explained in such a nice manner. Great video (y)

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thanks a ton Shubham 😀 I'm very happy you liked the video! 😀

  • @rafaborowski2323
    @rafaborowski2323 3 ปีที่แล้ว +2

    The most frontend value content on YT. Thanks a lot!

  • @AmitErandole
    @AmitErandole 2 ปีที่แล้ว +1

    This is the one that knocked it in with the concreteness of the examples. The other tutorials were just too abstract and playing around with letters

    • @BrunoAntunesPT
      @BrunoAntunesPT  2 ปีที่แล้ว +1

      Very very happy to read that. Thank you very much 😍

  • @Omar_Al_Seddik
    @Omar_Al_Seddik 2 ปีที่แล้ว

    Words can't describe how much I love you and your channel, Bruno.

    • @BrunoAntunesPT
      @BrunoAntunesPT  2 ปีที่แล้ว

      Thank you soo soo much Omar ❤️❤️❤️ you are very kind 😍

  • @tririfandani1876
    @tririfandani1876 3 ปีที่แล้ว +6

    React shines brightest with typescript among the other frameworks/libraries 💎

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      React and TypeScript seems like a perfect match!!! =D
      Angular also provides an amazing experience when working with TypeScript. I can't speak about vue3, because I have not tried it out yet =D

  • @joseavilasg
    @joseavilasg ปีที่แล้ว +1

    Awesome. I didn't expect to see the video until the end, but I did.

  • @Matt36788
    @Matt36788 3 ปีที่แล้ว +4

    "What can we do to make TypeScript complain at us?" I'm trying to avoid this everyday 🤣 Great video, thanks for making and sharing Bruno!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much 😍😍😍
      Ahahahah I remember I laughed at it when I was editing the video 😅😅😅

  • @vitorpereira7606
    @vitorpereira7606 2 ปีที่แล้ว +2

    Amazing job Bruno (as always)! Once again you helped me, thank you so much!

    • @BrunoAntunesPT
      @BrunoAntunesPT  2 ปีที่แล้ว +1

      Happy to hear that Vitor! Thank you 😍

  • @hamzahmd_
    @hamzahmd_ 2 ปีที่แล้ว

    I have learned the whole React TS in this video. Thanks for the easy explanation.

  • @susithra28
    @susithra28 2 ปีที่แล้ว +2

    Coming from Javascript background, although I know all the concepts of Typescripts that is explained in the video, I found it very difficult to apply. Your explanation gave me confidence since every single new concept is explained with a simple practical example. Truly amazing. Thanks a lot Bruno !!

  • @morrisseybr
    @morrisseybr 3 ปีที่แล้ว +1

    Wow man! This is GOLD! My thank you very much coming from Brazil!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Muito obrigado Samuel =D
      Fico muito feliz ao ler o seu comentario!!! 😍😍
      Um abraco deste amigo Portugues =)

  • @cseguino
    @cseguino 3 ปีที่แล้ว +2

    Amazing once again. Each time you manage to level up my skills. Your knowledge of typescript and your art of teaching it is a blessing.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much for your words Christophe 😍😍 I really really appreciate your comment my friend 😍😍

  • @CodaJohnPaul
    @CodaJohnPaul 2 ปีที่แล้ว +1

    Awesome video, Bruno! So far, your series has covered everything I want to know, thank you! *** To anyone reading, I highly recommend Bruno's videos. I had NO idea you could do so much just using types. Amazing.

  • @yassinerassy6840
    @yassinerassy6840 3 ปีที่แล้ว +1

    i've been waching alot of videos about typescript advance but they just didnt fit on real cases study but with your exemples using react im really excited to use it with react and i can see now clearly what are the beneficts ! thank you so much for your efforts !!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you Yassine for your amazing comment 😍
      If you have any question, even if it seems simple, let me know, I'll be here for you 😊

    • @yassinerassy6840
      @yassinerassy6840 3 ปีที่แล้ว +1

      @@BrunoAntunesPT thank you 😊 !

  • @tarunsukhu2614
    @tarunsukhu2614 3 ปีที่แล้ว +2

    Your content is great . Your humble way of presenting is really nice

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      So nice of you to say that, thank you very much Tarun! 😀😀

  • @marlonmarcello
    @marlonmarcello 3 ปีที่แล้ว +2

    Love the intro and the straight to the point use cases. Thanks for your work!

  • @JanderSilva01
    @JanderSilva01 3 ปีที่แล้ว +2

    Bruno, I wanted to know how to do this since I started to learn Typescript. Thank you again.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      I have received a few questions about this subject lately, so I decided to create a video explaining it. I'm very very happy it is useful 😍😍

  • @nishantshah_
    @nishantshah_ ปีที่แล้ว +2

    Hearty thanks for making this tutorial in such an understandable way. It has helped me a lot. 👏

  • @manishborkar7582
    @manishborkar7582 2 ปีที่แล้ว

    You get your self a new subscriber @Bruno , I am new to typescript and having issues but your video solves all of them, Thank you for the good explanation....

  • @IgorSilveira
    @IgorSilveira 3 ปีที่แล้ว +3

    This saved my life. Extremely well explained!
    Obrigado, Bruno 😃

  • @elioviaggi9701
    @elioviaggi9701 2 ปีที่แล้ว +1

    Molto utile, grazie per la condivisione Bruno!

  • @DanCortes
    @DanCortes 3 ปีที่แล้ว +1

    I recently started using TS with React and this video was so helpful. Thanks a ton!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you Daniel! 😊
      Glad it was helpful! 😀

  • @AmarMishra
    @AmarMishra ปีที่แล้ว

    Awesome explanation Bruno. Your content is amazing .

  • @Fatima-ie5kj
    @Fatima-ie5kj 3 ปีที่แล้ว +7

    I m so glad, we have a instructor like u thank you so much for providing awsum content ❤️❤️

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      I'm even more glad to have someone like you watching my videos 😍😍😍😍 Thank you very very much Faisal 😍

    • @codewithtyson7878
      @codewithtyson7878 3 ปีที่แล้ว +1

      @@BrunoAntunesPT don't say thanks bruh u deserve . Glad found this channel. Love from uae 💓

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      @@codewithtyson7878 I feel very lucky to have amazing people watching the channel. I feel very grateful 😍😍
      UAE? United Arab Emirates? I want to visit Dubai soooooo badly!!! 😀😀

    • @codewithtyson7878
      @codewithtyson7878 3 ปีที่แล้ว +1

      @@BrunoAntunesPT yea it's United arab emirates, n always welcome bro, ❤️💜

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      I'll go there one day, for sure!!! 😀

  • @nim3743
    @nim3743 3 ปีที่แล้ว +1

    Brilliant video. Easy to follow. Very useful concepts. Thank you.

  • @niara9700
    @niara9700 3 ปีที่แล้ว +1

    Typescript is amazing. Very insightful tutorial. Thank you.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much 😀
      I agree with you, TypeScript is amazing!!!!! 😀😀😀

  • @aayush135
    @aayush135 ปีที่แล้ว

    Very nice use cases. Your explanation was amazing. ✨✨

  • @sergiob3698
    @sergiob3698 3 ปีที่แล้ว +1

    Hi Bruno
    I didn't know TS was so powerful! Super cool
    Thanks for sharing

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you Sergio 😀 I always love to see your comments here, thank you soo much for the support my friend 😍

  • @mohdsajidshaikh4291
    @mohdsajidshaikh4291 3 ปีที่แล้ว +1

    Nice.
    Waiting for your videos atleast a week

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you 😀 hopefully I can record something for next week 😅
      Do you have any video topics you would love to see covered in the channel? 😀

    • @mohdsajidshaikh4291
      @mohdsajidshaikh4291 3 ปีที่แล้ว +1

      Yes i shared before.
      Nextjs blog with typeorm (for typescript).

  • @CreativeJE
    @CreativeJE 3 ปีที่แล้ว +1

    long time no see man. Thanks for awesome video

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you for visiting the channel 🙂

  • @jonasgedrat658
    @jonasgedrat658 3 ปีที่แล้ว +3

    Show de bola, parabéns amigo, continue sempre ajudando, é muito bom.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Muito muito muito obrigado Jonas 😍

  •  3 ปีที่แล้ว +1

    What an amazing explanation!

  • @emmyelijah7395
    @emmyelijah7395 3 ปีที่แล้ว +1

    Nicely done Bruno

  • @alinawaz4034
    @alinawaz4034 3 ปีที่แล้ว +1

    Amazing video love to see these

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Happy to know that! Thank you 🙂

  • @brmourinha
    @brmourinha 3 ปีที่แล้ว +1

    ganda maquina :D conteúdo excelente Bruno. Parabéns. Abraço

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Muito obrigado grande Bruno 😀 um grande abraço 😀😀

  • @arsalanshaikh3763
    @arsalanshaikh3763 3 ปีที่แล้ว +1

    Thanks a lot for the insightful video very helpful.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you my friend, I'm very glad it was helpful! 😀

  • @javiergarciafillol4454
    @javiergarciafillol4454 2 ปีที่แล้ว

    Good video I learned what I was looking for

  • @eqntdhjn
    @eqntdhjn 2 ปีที่แล้ว

    Thank you very much for the video!

  • @hhskladby1596
    @hhskladby1596 2 ปีที่แล้ว +1

    Great fun + know-how, but you should say "type alias" for the "type NAME = TYPE" construct

    • @BrunoAntunesPT
      @BrunoAntunesPT  2 ปีที่แล้ว

      Thank you very much 😍 what did I call it in this video? (I don't remember but I'm curious) 😂

    • @hhskladby1596
      @hhskladby1596 2 ปีที่แล้ว +1

      @@BrunoAntunesPT You say just "types" what may be misleading and is no help for those who want to find details in the docs, having "alias" as the official terminology and specific concept

    • @BrunoAntunesPT
      @BrunoAntunesPT  2 ปีที่แล้ว

      @@hhskladby1596 ah...I'm relieved, I thought I had called it something worse but the way you said it initially 🙂😅

  • @chioo9495
    @chioo9495 3 ปีที่แล้ว +1

    Thanks Bruno.
    NextJS TS + Graphql with codegen is good. i wish you make a crash course about that someday :)

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you 😀
      That's for sure an interesting topic! Curious to know, are you using Apollo client or some other client currently? 😀

    • @chioo9495
      @chioo9495 3 ปีที่แล้ว

      @@BrunoAntunesPT Yeah!. Apollo Client would be Great!. You also do a Poll about that in your YT Community

  • @pinocodex
    @pinocodex 2 ปีที่แล้ว +1

    Super helpful man! Thanks

  • @kushnirov
    @kushnirov 7 หลายเดือนก่อน

    I found at last week your video about npm publishing flow with github actions and subscribed, but I didn't expect that on the weekend I unexpectedly find a video describing a solution to a typescript issue in a project that I didn't solve, I've tried to write a solution for the Dropdown case from the example, but ended with a ts-ignore, thanks, want to refactor that code now

  • @raphaelpc
    @raphaelpc 3 ปีที่แล้ว +1

    Amazing explanations!

  • @alapatisrikanth3412
    @alapatisrikanth3412 3 ปีที่แล้ว +1

    Liked it
    U made it look lot easier

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you 😀😀 I'm glad you enjoyed it 😀

  • @ThienTran-lj8id
    @ThienTran-lj8id 2 ปีที่แล้ว

    Its really awesome, many thank you

  • @gambit3904
    @gambit3904 3 ปีที่แล้ว +3

    Thank you, Bruno!!

  • @ТимурСагайдаков
    @ТимурСагайдаков 3 ปีที่แล้ว +1

    Big Thanks from Russia)

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you 😊😊 greetings to my Russian friends 😉😉

  • @abdulazeezolanrewaju843
    @abdulazeezolanrewaju843 3 ปีที่แล้ว +1

    Thank you so much... Can you please give more details on Types and Interfaces

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +2

      Thank you my friend =D
      From the typescript docs, they have a very good summary (in my opinion): "Type aliases and interfaces are very similar, and in many cases you can choose between them freely. Almost all features of an interface are available in type, the key distinction is that a type cannot be re-opened to add new properties vs an interface which is always extendable."
      You can read the full article at: www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces

  • @anoopvasudevan
    @anoopvasudevan 3 ปีที่แล้ว +2

    Good one. Thank you.
    One question, like in example 1 with discriminating unions, how can we destructure the props received by the function?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +2

      Thank you 😍
      You need to narrow down the type you are working with for typescript, you can't use destruct. For example something like:
      ```
      if (props.shape === "rectangle") {
      // over here you now have all the rectangle props like height and width :)
      }
      ```
      You can see more examples and a deeper explanation over here: www.typescriptlang.org/docs/handbook/unions-and-intersections.html#union-types
      I hope this helps 🙂 let me know if you still have questions 🙂

  • @soyoungk9673
    @soyoungk9673 3 ปีที่แล้ว +1

    good! thanks! I'm subscribed to your channel!:D

  • @MrKeepItTrill
    @MrKeepItTrill 2 ปีที่แล้ว

    Excellent video, really helped me level up my TypeScript skills. One question: for the last example, are the any advantages/disadvantages to doing this instead, or is it identical?:
    type DropdownStrNumProps = {
    data: Array;
    labelProp?: never;
    valueProp?: never;
    };
    type DropdownObjectProps = {
    data: Array;
    labelProp: keyof T;
    valueProp: keyof T;
    };
    type DropdownProps = DropdownStrNumProps | DropdownObjectProps;

  • @zvrk
    @zvrk 3 ปีที่แล้ว +1

    Thank you for an awesome video

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much Milos! Glad you enjoyed it! =D

  • @dauletbaimagamabet
    @dauletbaimagamabet 2 ปีที่แล้ว

    Excelent video, thank you

  • @rangabharath4253
    @rangabharath4253 3 ปีที่แล้ว +1

    Awesome as always 👍😀

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you very much Ranga! 😀😀😀

  • @jibinkoshy2739
    @jibinkoshy2739 3 ปีที่แล้ว +1

    awesome explanation

  • @vladahinski5699
    @vladahinski5699 3 ปีที่แล้ว +1

    Thank you so much! 🙏

  • @bryanltobing
    @bryanltobing 2 ปีที่แล้ว

    when we hover the component the error message is unclear. especially for oneortheother component, is there a way to manually set the error message?

  • @gustavolodividaletti803
    @gustavolodividaletti803 ปีที่แล้ว

    Olá Bruno! Tudo bem? Será que temos como fazer isso para componentes?
    Por exemplo:
    {}
    }} />
    E, nesse caso fazer com que o 'componentProps' carregue as Props do componente passado na prop 'component'?
    Eu só consegui fazer isso funcionar como patâmetros de uma função, utilizando React.ElementType e React.ComponentProps.

  • @ukaszkonatowski4661
    @ukaszkonatowski4661 ปีที่แล้ว

    Hey @BrunoAntunesPT :)
    Thank you for this tutorial!
    I have some issues with creating conditions related with displaying proper component.
    Could you help me with this?
    To be more specific, I'd like to create CustomLink component which will return MUI5 Link component OR MUI Link component with Link prop - "component={NavLink}" from react-router.
    I want to have a condition where you can pass "to" prop OR "href" prop.
    If I pass "to" prop, I want to allow developer to share props from MUI Link component and React router NavLink component.
    If I pass "href" prop, I want to allow developer to share only props from MUI Link component.
    I am struggling with it quite a while, but I still have some lack of knowledge how I could do that (probably using generic types). I was looking for it in some resources like in MUI and there are some solutions, but not exactly what I've described.
    If you are willing to help me with this or anyone else, I would be grateful.
    If not, that's also ok :)
    All the best!

  • @damiangilz
    @damiangilz 3 ปีที่แล้ว +1

    That's brutal!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      TypeScript is amazing my friend!! 😀

    • @damiangilz
      @damiangilz 3 ปีที่แล้ว +1

      Yes I love TS but I tend to shy away from generics because I quickly forget the application. After some reviews from your code I have much more clarity. Thanks. I didn't even know about the intersections. Pretty amazing! Thanks!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you for saying that. You made me happy 😍😍

  • @mgominasian9206
    @mgominasian9206 ปีที่แล้ว

    why during destructing it gives an error.

  • @JeFn76
    @JeFn76 3 ปีที่แล้ว +1

    thx, it solved my problem

  • @hugodsa89
    @hugodsa89 3 ปีที่แล้ว

    Hey Bruno,
    A few issues I found with your last example:
    1 - after the ternary testing whether the generic extends a number or a string, it is unnecessary to have labelProps and valueProps with the type of never, better to simply not have them.
    2 - there is an issue with the generic type, in the case that it is not a number or a string, it could be a boolean, or an empty object, or literally anything else so I would suggest testing for that too maybe.
    3 - your valueProp and your labelProp can be the same key of the generic type and that wouldn't something desirable in most cases.
    How would you suggest to handle these?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Hello Hugo,
      Let me answer one by one, probably it will be easier 😂 If you have any questions, let me know 😊
      1 - This one will boil down to personal preference. You can decide to keep "never" there or remove it. I personally prefer to keep "never" there, because it shows my intentions in a much cleaner way to the next developer that reads my code.
      Don't forget that this is a very simple example with only 3 properties - when we have real world types with 20+ properties, multiple unions, generics with , etc... it's easy to get lost in all that
      Adding "never" helps me on my mental mappings, but I know that not everyone is like me and that's fine. I honestly don't mind to write a bit more code in hope it will helps my colleagues in their mental mappings as well. I apply the same concept regarding documentation 😊
      In the end, use something that you and your team can keep consistent and feel comfortable with - that's the most important thing 😊
      2 - I'm aware of that, you can add more restrictions, this was just for the example 😊
      3 - I understand what you want to do, but I don't agree with you on this one.
      In my view, it's not the responsibility of this component to decide that. We should give the developers using this component that power/responsibility, because that will depend on the data they are using. Actually, last week (Tuesday or Wednesday) I had a task that would be "impossible" with that "limitation" 😊
      I can even describe it - I received all phone numbers from a user in the following format from the API: [{phoneNumber: 987654321}, {phoneNumber: 123456789}]
      As you can see, my key and label had to be exactly the same, even if I wanted to, I had nothing else to grab... 😊
      Those type of restrictions/optimizations seem nice at first, but as soon as your colleagues start to use real APIs, those restriction might become blockers. Of course, in my case, I could do an arrayFromApi.map(a => a.phoneNumber) and get an array of strings, but... I would absolutely hate a component that forced me do that... 😂
      We want the types to help people during development, not to block them or annoy them when what they are doing is completely valid 😊
      If after knowing the limitations of that decision, you want to go ahead with that, you will want to use Exclude utility - www.typescriptlang.org/docs/handbook/utility-types.html#excludetype-excludedunion
      I hope this helps 😊

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Now that I'm thinking a bit more about point 3, I don't even know if you can achieve it that easy... maybe yes, maybe not 😊

    • @hugodsa89
      @hugodsa89 3 ปีที่แล้ว +1

      @@BrunoAntunesPT hey thanks for getting back to me. I really appreciate.
      1- I get what you mean by being verbose and explicit, I find the only advantage is the fact that when in a PR you’ll have to accept the removal of a line with an explicit intent rather than accepting the addition of a line with the same key name and that could potentially go against the intended definition and use to begin with. So I agree there, but i also find that you could probably use some form of Pick utility type and enforce all others to be never, not sure exactly what approach to use here, but definitely not writing all the keys would be the best approach. Anyway I like your point, though wouldn’t use it in production.
      2- what I meant is that would probably be best to have a better defined handling, rather than testing for string and number, and hand off all other cases to the false side of the ternary, maybe handle the case by checking for a non empty object array, and then pass all other cases to the false side of the ternary.
      3- yeah this is quite hard I was hoping to use typeof but not really possible even with usage of exclude or omit. Though would love to know how it could be achieved.
      Thanks! Well done mate. Keep up the good content. I’d love to see you go deeper with the ts type system. 👍🏻👍🏻👍🏻 it’s actually extremely powerful.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you Hugo 😀

  • @mateusvahl5072
    @mateusvahl5072 3 ปีที่แล้ว +1

    Awesome!

  • @BrunoPereira-mo6kg
    @BrunoPereira-mo6kg 3 ปีที่แล้ว +1

    Great video Bruno 😁 thank you so much!
    I've just one doubt, in the part of the video you place valueProp="b" and b was a property of the object, that would fail, it wouldn't return the proper value. There is any fix for this case?
    Thanks a lot 😁

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      What do you mean Bruno? Se quiseres podes dizer em português 😊
      BTW - I love your name 🤣🤣🤣🤣🤣

    • @BrunoPereira-mo6kg
      @BrunoPereira-mo6kg 3 ปีที่แล้ว +1

      @@BrunoAntunesPT 🤣🤣🤣🤣
      A pergunta que estava a fazer de certa forma já percebi... foi no minuto 22:19 em que estavas a colocar valueProp igual a "c". Mas não tinha reparado que na "data" estava um objecto com as propriedade a, b e c. Estava a parecer que era uma array em que em cada item tinha uma propriedade diferente, ou seja [0] = {a: "1" }, [1] = {b: "2"}, [2] = {c: "3"} e por isso não estava a perceber, porque não fazia sentido o valueProp ter uma propriedade que só existia em determinados itens. Mas já percebi que era um objecto 😁
      Thank you!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Ahhhh awesome 😍😍 por acaso quando fizeste a pergunta fiquei super confuso ahah 🤣🤣
      Verdade seja dita, eu podia ter criado um objecto com nomes decentes em vez de a, b, c, 😅 my bad 😅😅😅😅

    • @BrunoPereira-mo6kg
      @BrunoPereira-mo6kg 3 ปีที่แล้ว +1

      @@BrunoAntunesPT não, não tiveste culpa 😅 eu é que percebi mal 😅 desde já obrigado pelo vídeo e pelo tempo para ver comentários 😁

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Obrigado eu por veres o vídeo e pelo feedback grande Bruno 😀😀

  • @samerkayali4525
    @samerkayali4525 3 ปีที่แล้ว +1

    Amazing content!!!
    Already subscripted!

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much Samer 😊😀

  • @mustafwm
    @mustafwm 3 ปีที่แล้ว +1

    Thanks, that was informative.
    I just learned about forcing types to be true/false (i.e. deafultCollapsed: true) and first impression is: not a fan. I feel they restrict users from passing dynamic values to props. .. but still good to know they're there :)

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Glad it was helpful! =)
      I received quite a few questions lately asking how to do that... so I decided to add it in this video :D
      As you saw, I'm also not a huge fan =D

  • @VenusOnlineSoftware
    @VenusOnlineSoftware 3 ปีที่แล้ว +1

    hey I see here is the best tutor.
    export interface TeamProps {
    establishments: Option[];
    members: Member[];
    }
    export interface Option {
    id: string;
    label: string;
    }
    export interface Member {
    avatarUrl: string;
    name: string;
    }
    can you tell me how to pass props for the these types of arrays when the component is called in another component?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Thank you very much 😍
      Sorry, can you detail a bit more what you want to achieve?
      if you have a component like:
      ```
      export function YourComponent({establishments, members}: TeamProps){ .....}
      ```
      then to call it somewhere you need to:
      ```
      ```
      Not sure if this is what you are looking for, please let me know :)

  • @thinBillyBoy
    @thinBillyBoy 3 ปีที่แล้ว

    I have a question, Bruno. If I want to use one thing or another thing but both with different stylesheets what should I do?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      It depends quite a lot on the tech you are using. It will depend quite a lot on what you use: CSS/SCSS/LESS files? Styled Components? Emotion? Material-UI? :)
      For material-ui they have this good example playground: material-ui.com/customization/color/#playground

  • @BonBonInoc
    @BonBonInoc 3 ปีที่แล้ว

    hi how can i render other props ? i cant seem to access like {props.height} etc. please help

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      You need to narrow down the type you are working with for typescript. For example something like:
      ```
      if (props.shape === "rectangle") {
      // over here you now have all the rectangle props like height and width :)
      }
      ```
      You can see more examples and a deeper explanation over here: www.typescriptlang.org/docs/handbook/unions-and-intersections.html#union-types

    • @BonBonInoc
      @BonBonInoc 3 ปีที่แล้ว +1

      @@BrunoAntunesPT yeah I have to conditionally render the props also. Thanks Bruno! Keep it up

  • @AmitSNamboothiry
    @AmitSNamboothiry 2 ปีที่แล้ว

    Lifesaver 😊

  • @mkonin
    @mkonin 2 ปีที่แล้ว

    thnx man from 2022

  • @arunkumar2786
    @arunkumar2786 3 ปีที่แล้ว +1

    Hello bro . I think are u busy that why u not upload videos.

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Yeah.... I have been very very very busy.
      I'm trying as hard as I can to go back to more frequent uploads, but it has been very hard lately to find the time, I'm sorry :(

  • @doniaelfouly4142
    @doniaelfouly4142 10 หลายเดือนก่อน

    thanks

  • @mfion1
    @mfion1 2 ปีที่แล้ว

    Awesome

  • @dennisgonzales9521
    @dennisgonzales9521 2 ปีที่แล้ว

    thanks!

  • @vittoriomorellini1939
    @vittoriomorellini1939 3 ปีที่แล้ว

    Hi Bruno. Are you expert of reactn? Do you use it?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      By reactn you mean react native? If that's the question, the answer is very short: "no" 🤣🤣🤣

    • @vittoriomorellini1939
      @vittoriomorellini1939 3 ปีที่แล้ว +1

      @@BrunoAntunesPT hi Bruno. You are a good teacher. I meqn reactn the way to manage the global state. It's an easy way respect to redux

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +1

      Thank you very much 😍😍
      Ahhhh I see... But the answer for that one is also "no" 🤣🤣 the longer answer is that I stopped using redux probably around 2 years ago (more or less) 😊

    • @vittoriomorellini1939
      @vittoriomorellini1939 3 ปีที่แล้ว

      @@BrunoAntunesPT ok. Good. What are you using for the state?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      Most applications I know are using redux as some kind of "cache" between server and client. For that scenario something like swr or react-query is a much nicer and easier in my opinion 😊
      When I need states and transitions between states (basically a state machine) I have used xstate and I'm starting to fall in love with it for those very very complex state machines - I'm not a specialist in xstate yet, but I'm loving every second I use it 😊
      With swr and react-query alone I feel most applications don't need redux.
      When you add xstate, it's even better. This being said, some people love to use redux, and that's nothing wrong with it.
      In the end as I always say, more important than the tools we use is what we deliver as user value. If you are able to be more productive with tool A vs tool B, just use what you are best at, your users don't care if it's redux or anything else, as long as it's fast and they can do everything they need in your app without bugs 😊

  • @changemaker2909
    @changemaker2909 3 ปีที่แล้ว +1

    First Comment

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว +2

      Thank youuuu =D
      In the future, I need to think about some kind of prize for the first comment 😀

  • @Svish_
    @Svish_ 3 ปีที่แล้ว

    Couldn't you just leave the properties out, instead of using never?

    • @BrunoAntunesPT
      @BrunoAntunesPT  3 ปีที่แล้ว

      In this examples I showed you need them there 😊
      Better than any words I can say in the video description you can find the github URL 😊 let me know if you have any other questions after playing with it 😀😀