Learn React PropTypes In 13 Minutes

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

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

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

    Lots of comments here saying that this is redundant because we can just use TypeScript.
    I've not learned much TypeScript yet, so I'll probably change my mind once I know more, but, I feel like switching to TypeScript would require me to down-tools on everything else I'm working on, at least for a time. This looks like a good way to start introducing Types to some of my components without making the full switch.

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

    Why don't these videos have a zillion likes? The clear and perfectly understandable way you explain these concepts is just awesome. Even when some of these are about concepts I already know and use I still watch them because there's always some nice new detail to learn about them. Excellent work! thanks

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

      these videos don't have a zillion likes because there are only 7 billions of us.

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

      @@beatboss9275 hahahaha 😂😂😂

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

    i absolutely love typescript

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

    This was exactly the kind of resource I was looking for as an introduction, and that there was an article linked as well for reference? May this man never step on a lego for the rest of his days.

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

    Kyle's videos just keep getting better and better. Thanks for your efforts mate.

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

    TS static checks your types. If you handle TS well enough, your app will probably be free of this type bugs.
    That being said, it does only static type checking. If you make some ajax call, you won't be able to static check it's response, since it will be available only during runtime.
    PropTypes, in the other hand, can help us with those runtime type checks (kinda limited when we talk about functions parameters, but still great).

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

      Runtime type checks even in that case really aren't necessary though. If you're making an ajax call to an external resource, there's probably some documentation telling you what the return type will be. With TS you can model the return type in your code and cast the returned data to the type after doing some basic preliminary checks. If you're making an ajax call to an internal resource, then there should be a common module with request and response types. Again, cast the response to the response type from the common module, and you'll get compiler errors if the type changes.

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

      @@harleyspeedthrust4013 You're right. Good point!

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

      @@juliohintze595 Thank you!

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

      There are schema validation for run time if you need it

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

    Great video, thank you for all your effort! I think you should start making react typescript tutorials as that is what is becoming the norm these days

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

    i’d rather use typescript :)

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

    Not to be rude or anything but there is no way I use something like this while there is Typescript. Even if I had a todo application with a single component, I would still use Typescript.

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

      The isRequired property can still be useful

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

      I totally agree with u, and I don't think typescript is overhead even for small projects

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

      @@sheldon6520 also solvable with typescript by adding question mark to the type you make it optional

    • @okonkwo.ify18
      @okonkwo.ify18 2 ปีที่แล้ว

      Same

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

    it's nice that propTypes are similar to yup validation type options.

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

    And the best part is, ES7, react extension on VSCode autocomplete all the props while declaring a component. So, this is the best practice to create maintainable and sharable components.

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

      link of extension bro?

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

      @@adivmt Ya Sounds useful if you could please share :)

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

      Its called ES7

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

      @@13Daniel37 thanks

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

    Gracias por todo genio, siempre que tengo confusion en algo vengo directamente a tu canal y problema resuelto!

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

    TypeScript is easy and great. All hail TypeScript!

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

    Watched your video after longtime and felt very nice.

  • @HabiburRahman-uy6qv
    @HabiburRahman-uy6qv 3 ปีที่แล้ว +3

    Kyle your my motivation

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

    Make a typescript tutorial (with REACT will be helpful) 💗

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

    Just incredible. Keep up with the good work

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

    man you are amazing, thank you so much for your work

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

    Simply Brilliant kyle 👌👌👌 !!!

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

    Love you dude. You make my life saver content. Tnx a lot

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

    Your videos are always short and spot on 🔥

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

    Hats off , Well explained

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

    Uhhh nice one but I would still rather go with typescript

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

      You may never know what they want on the job, man)

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

      @@dimitridoroshko If a company is using this backwards way of doing types instead of typescript then I don't want to work there

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

      @@harleyspeedthrust4013 but do you have a lot of choice?

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

      @@dimitridoroshko yes, nobody is forcing me to work anywhere. If I don't like it I can quit tomorrow and find somewhere else to work. Or I can apply myself and start a business. Nothing is keeping me from doing these things except myself.

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

    Great video as usual. Thank you, brother.

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

    Thank you, Kyle. Great explnation.

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

    thanks
    you really made it simple now

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

    Hy Kyle, please make an video about deployment and stuffs about server, SSL, etc

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

    as always, your videos are awesome!

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

    This was really usefull! Thank you so much!

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

    amazing tutorial , thanks

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

    Kyle what if we use TS instead ??

  • @kaspe19
    @kaspe19 6 หลายเดือนก่อน

    what extension do you use in VS code so that the prop types option shows up when you type proptypes?

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

    Proptypes are very very useful. Great video!
    But what are your views on TypeScript?

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

    wow.. really useful video, thanks

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

    I don't understand when you would use this. Typescript seems to do the job. Also, do you only write proptypes when debugging? And then you erase them when you have found your bug? So it's like a super console.log()?
    It is not explained clearly.

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

      No you always keep them in the component. This is to make sure that you always use this component the way it is supposed to be used.

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

      proptypes don't run in production mode even if you don't remove them. Also proptypes is only for legacy code. You can't migrate an entire application from js to typescript just for these validations.

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

      @@chethanprabhu4475 i'm sorry, I didn't understand this. Isn't PropTypes something from Vue? Could you explain again?

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

    There is also a custom validation functionality where the user can predefine a custom validation function and throw an error in it if the prop fails a validation.

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

      Is it built in? Can you share the link for the documentation?

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

      @@rizqyhbb I think he just means writing a function yourself to validate the type

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

    Nice man 🙌🏼

  • @ManojKumar-iu3zh
    @ManojKumar-iu3zh 3 ปีที่แล้ว

    Love from India ❤️ where are you from Kyle?

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

    As always . Fun to watch .

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

    nice video sir, thanks

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

    And is there a way to propagate these errors in compile time or notify about them instead of logging them into the console, where nobody notices them usually?

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

      Typescript is your answer

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

    I was like " whatt , wireless bug ?"
    😆

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

    Nice overview of PropTypes, but I don't understand why you say Typescript has high overhead. Typescript does compile time checking and should have no run time overhead. PropTypes does a run time check with overhead if it's libraries. Isn't PropTypes an easy hack to get partial checks?

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

      I think he was just touching on the overhead of writing typescript in the first place.

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

    Very useful, thx !!

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

    As a noob I ask, is this why Typescript?
    Never used it yet but I like the idea of strict typing

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

      This works only in react. typescript is a totally different language

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

      typescript is language with , tons of great features proptypes is one of the similar one

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

      @@aravindmuthu5748 yes I've got that. I'm merely speaking on why TS vs vanilla js, react etc

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

      Yea, this the most important thing about TS. I also found that working with packages is way easier with typescript, because the autocomplete works better than without it.

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

      @@opinetree code gets more robust and its like , security checkpoint everywhere in ts to guard code

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

    Awesome video thanks alot

  • @mastryt8224
    @mastryt8224 9 หลายเดือนก่อน

    that intro guitar music is played by kyle🙌🙌

  • @АлександрЗемляной-я9и
    @АлександрЗемляной-я9и 3 ปีที่แล้ว

    What is the best option for object with dynamic properties?

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

    Great video as always but proptypes is just stupid. The proper solution here is to just use typescript, which is what JavaScript should have been in the first place. If you only want to enforce types on your react components' props, you can do that with typescript.

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

      may be typescript is big ecosystem, but you need only check some records from db or responses from api, etc

  • @syedalimehdi-english
    @syedalimehdi-english 3 ปีที่แล้ว +3

    I use TypeScript 😂😂

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

    I love this guy

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

    increible maestro!

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

    Thanks Kyle. Super cools

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

    Thanks so much!!! :)

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

    Hey can you do a tutorial on react-vis? Or react data visualization?

  • @ST-rq8gk
    @ST-rq8gk 3 ปีที่แล้ว +1

    Hello :)
    i am interested in buying the learn react today course. can somebody tell me if the course is still up to date in 2021? love the explanations of kyle, but i also want to learn "modern" concepts because the course came out in 2019 I think

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

    I wish JavaScript had this kind run time type checking ability. Type Checking at runtime can also make the language faster as less the code would be much more predictable

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

      So you wish JavaScript was TypeScript?

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

      @@TheBswan Typescript can only check types statically or ahead of time. Not in runtime or just in time. Its a basic difference

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

      If you need to typecheck at run time you can write code for that lol. If typeof x === null return 'i goofed'

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

      @@TheBswan Yeah, that's the problem. Why would I check it manually. I want type checking being handle by the JSVM/interpreter like other typed languages. I want that kind of runtime safety

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

      @@krtirtho why would you rather have runtime type checking that compile time type checking? Don't you wish you knew your code would work before you ship it? I've heard the argument about runtime type checking for API calls and things like that, but the solution there is to just model the return type in your code, or share common types between the API implementation and the API consumer. And runtime type checking would make your code slower, because the interpreter can no longer just assume that the types work out - it has to check them for itself. Typically the more you can accomplish at compile time, the faster your code will be

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

    Can someone tell me what would happen in runtime due to wrong type pass as prop type?
    Typescript doesn’t warn as It check only at compile time. This wrong type will throw exception in UI. What if we proptype placed?

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

    please make a tutorial for testing react with jest

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

    Thanks!

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

    Why not using typescript!

  • @KaranSharma-ew7io
    @KaranSharma-ew7io 3 ปีที่แล้ว

    man your hair 🤩

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

    2 years later, typescript became the standard in business.

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

    kyle is the best

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

    A question here, im new to react, is it a common practice to assign a proptypes to every props that is ever needed to passed into a component?

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

      No Need of it, but it can be used for strict way of code. So no mistakes can occur.

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

    I learned propsTypes a few months ago and I immediately threw it in the trash

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

    TS ftw

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

    Plot twist: Sally has Rapid Aging Disorder

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

      Benjamin Buttons cousin

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

    why everybody it's working for them, i'm using typescript in my project and i'm beginner to it, when i define propTypes of my component and place them as a parameters to the component for example:
    Binding element 'description' implicitly has an 'any' type.ts(7031)

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

    Thanks

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

    react again, thanks kyle

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

    Legendary

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

    Thanks.

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

    God or what ?😅

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

    For this use case, typescript seems to be the better choice.

  • @HabiburRahman-uy6qv
    @HabiburRahman-uy6qv 3 ปีที่แล้ว +1

    You motive me

  • @ritwik.banerjee
    @ritwik.banerjee 3 ปีที่แล้ว

    How to show the paragraph again? Please help.
    Page title
    i am a paragraph.iam a long paragraph
    on/off

    let para = document.getElementById("para");
    para.style.background = 'red';
    para.style.color = 'white';
    let btn = document.querySelector('#btn');
    btn.style.color = 'blue';
    btn.style.background = 'lightGreen';
    btn.addEventListener('click', function run(){
    para.style.display = 'none';
    });

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

    I would like to start learning how to program, but i dont know where to find good stuff to study and learn...

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

    Just use typescript

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

    Or use typescript 😂🤗 (dont take it bad)

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

    You definitely should use TypeScript instead

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

    nice!

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

    What is the difference between propTypes and PropTypes?

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

    once I get a job, I will find you and pay you !

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

    You can import prop-types from React now, so installing it separately is unnecessary.

  • @kebab-case
    @kebab-case ปีที่แล้ว

    Or just use Typescript?

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

    Who is Sally 😃???

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

    FEWER bugs not less bugs

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

    I use Yup and they are almost same.

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

    Poor man's typescript 😂

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

    This "bug" at the outset is exactly why combine 2 languages (HTML/JS) like this is so problematic.

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

    Typescript is much better.

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

    hello, first

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

    publish date is my birthday

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

    dude calls typescript overhead but still uses a react library to solve react's type problem that works like typescript😆😆

  • @golf-and-surf
    @golf-and-surf 3 ปีที่แล้ว

    Winner is Typescript

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

    Naaaah... just use TypeScript. It has way better tooling, especially in VSCode

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

    Hello world!

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

    It would be amazing if you'd just make tutorials based on typescript. Pure JS is dying.

  • @Just_Clair
    @Just_Clair 2 หลายเดือนก่อน

    Deprecated now! Instead include prop type in function parameters itself.