Learn React PropTypes In 13 Minutes

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

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

  • @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 года назад +11

    i absolutely love 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 Год назад

      Same

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

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

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

    i’d rather use typescript :)

  • @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 2 года назад +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

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

    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.

  • @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

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

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

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

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

  • @HabiburRahman-uy6qv
    @HabiburRahman-uy6qv 3 года назад +3

    Kyle your my motivation

  • @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.

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

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

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

    Thank you, Kyle. Great explnation.

  • @nguyensonhak15dn78
    @nguyensonhak15dn78 3 года назад +1

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

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

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

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

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

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

    Your videos are always short and spot on 🔥

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

    Great video as usual. Thank you, brother.

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

    Just incredible. Keep up with the good work

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

    Watched your video after longtime and felt very nice.

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

    thanks
    you really made it simple now

  • @danielstill5625
    @danielstill5625 3 года назад +1

    TypeScript is easy and great. All hail TypeScript!

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

    Hats off , Well explained

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

    Simply Brilliant kyle 👌👌👌 !!!

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

    This was really usefull! Thank you so much!

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

    as always, your videos are awesome!

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

    Thanks!

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

    I love this guy

  • @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

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

    As always . Fun to watch .

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

    that intro guitar music is played by kyle🙌🙌

  • @MaxProgramming
    @MaxProgramming 3 года назад +1

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

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

    amazing tutorial , thanks

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

    TS ftw

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

    nice video sir, thanks

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

    wow.. really useful video, thanks

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

    Very useful, thx !!

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

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

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

    Nice man 🙌🏼

  • @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.

  • @ManojKumar-iu3zh
    @ManojKumar-iu3zh 3 года назад

    Love from India ❤️ where are you from Kyle?

  • @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

  • @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

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

    Thanks.

  • @syedalimehdi-english
    @syedalimehdi-english 3 года назад +3

    I use TypeScript 😂😂

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

    Awesome video thanks alot

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

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

    increible maestro!

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

    kyle is the best

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

    Thanks so much!!! :)

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

    Thanks Kyle. Super cools

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

    I was like " whatt , wireless bug ?"
    😆

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

    Thanks

  • @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

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

  • @bongvatana6803
    @bongvatana6803 3 года назад +1

    Legendary

  • @dsa0decoded
    @dsa0decoded 3 года назад +1

    Kyle what if we use TS instead ??

  • @HabiburRahman-uy6qv
    @HabiburRahman-uy6qv 3 года назад +1

    You motive me

  • @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 2 года назад

    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?

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

    nice!

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

    How about checking an instance of a class?

  • @hamodeyDooba
    @hamodeyDooba 3 года назад +1

    Why not using typescript!

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

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

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

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

  • @user-ci5hf5oe1f
    @user-ci5hf5oe1f 3 года назад

    What is the best option for object with dynamic properties?

  • @jatinhemnani1029
    @jatinhemnani1029 3 года назад +1

    Just use typescript

  • @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)

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

    2 years later, typescript became the standard in business.

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

    please make a tutorial for testing react with jest

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

    God or what ?😅

  • @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';
    });

  • @KaranSharma-ew7io
    @KaranSharma-ew7io 3 года назад

    man your hair 🤩

  • @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.

  • @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...

  • @seghirissam2662
    @seghirissam2662 11 месяцев назад

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

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

    Plot twist: Sally has Rapid Aging Disorder

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

    react again, thanks kyle

  • @marcelfischer7815
    @marcelfischer7815 3 года назад +6

    You definitely should use TypeScript instead

  • @kebab-case
    @kebab-case Год назад

    Or just use Typescript?

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

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

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

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

  • @n3x404
    @n3x404 3 года назад +1

    Or use typescript 😂🤗 (dont take it bad)

  • @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 !

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

    I use Yup and they are almost same.

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

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

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

    {2021-10-05}

  • @golf-and-surf
    @golf-and-surf 3 года назад

    Winner is Typescript

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

    Poor man's typescript 😂

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

    hello, first

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

    publish date is my birthday

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

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

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

    Coming from typescript this makes me feel dirty

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

    Who is Sally 😃???

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

    FEWER bugs not less bugs

  • @HabiburRahman-uy6qv
    @HabiburRahman-uy6qv 3 года назад +1

    You touch my hreat