React TypeScript Tutorial ( Setup, Installation, Static Type Checking )

Поделиться
HTML-код
  • Опубликовано: 24 авг 2024
  • Using Typescript with ReactJS project, Install, Configure and use concepts like Interface, type guards and set default Props. Use inside a class component and a functional component.

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

  • @mianibrahim5214
    @mianibrahim5214 6 лет назад +2

    Very short and concise way to describe typescript. Provided just the right syntax I was having trouble with. Keep it up!

  • @anushasdiary789
    @anushasdiary789 4 года назад

    Many Thanks . Your tutorials are very simple to understand.

  • @billybobgeo
    @billybobgeo 5 лет назад +16

    Using create-react-app 3.0, on app creation it says react-scripts-ts is deprecated, so the new syntax should be
    $ create-react-app --typescript

    • @Techsithtube
      @Techsithtube  5 лет назад +2

      Thanks for the info

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

      it`s gonna be deprecated soon so now it`s better to use --template typescript

    • @gabrielfono844
      @gabrielfono844 4 года назад +3

      create-react-app [app-name] --template typescript in 2020
      after this, we can just follow the tutorials without any issues
      thanks

  • @d0m2288
    @d0m2288 5 лет назад +2

    Great introduction, thanks for sharing.

  • @yogeshbhawsar5002
    @yogeshbhawsar5002 4 года назад

    Very good explanation. i like your way to describe it, prepare more video with redux also. Thanks

  • @IamRenzx
    @IamRenzx 5 лет назад

    Typechecking on nested object would be a great help! I always handle this kind of stuff at my work.

  • @TheAidsaids
    @TheAidsaids 6 лет назад

    I really enjoy your videos. Thanks for the typescript explanations.

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

    Thank you for the tutorial!

  • @icycooldrink6085
    @icycooldrink6085 5 лет назад +2

    Great content delivered directly and succinctly. Thanks. The only issue I am having is with type MyCompProps in MyComp.tsx. Getting "Use interface instead of type literal". Not sure what that means, but apart from that, great stuff.

  • @gabrielfono844
    @gabrielfono844 4 года назад

    thanks techsit for such an amazing content

  • @leslie7922
    @leslie7922 5 лет назад

    thank you, enjoyed the calm explanation

  • @wilhelm.reeves
    @wilhelm.reeves 4 года назад

    Your videos are pretty succint, thankYou!

  • @Gimmiyimmy
    @Gimmiyimmy 5 лет назад

    excellent

  • @pratikchotai453
    @pratikchotai453 6 лет назад

    Awesome tutorial.
    Thanks

  • @garychan1967
    @garychan1967 5 лет назад +1

    CC translate this as: "Welcome to sexy tutorials!" LOL.

    • @Techsithtube
      @Techsithtube  5 лет назад +3

      LOL, Should i leave it as it is or fix it. I might leave it as it is. :)

  • @1111ah
    @1111ah 6 лет назад

    Awesome tutorial... thanks!

  • @dineshbabu12345
    @dineshbabu12345 6 лет назад

    Excellent tutor. Thank you so much :)

  • @mohammedrabea2421
    @mohammedrabea2421 6 лет назад +2

    Thank you, keep on

  • @user-pm4wq2rv9h
    @user-pm4wq2rv9h 5 лет назад +1

    Thanks a lot.

  • @jgraves4532
    @jgraves4532 6 лет назад

    you give good tutorials, really should be using the new syntax for us newbies.

    • @Techsithtube
      @Techsithtube  6 лет назад

      thanks for watching J. You are you planning to use typescript with react?

    • @jgraves4532
      @jgraves4532 6 лет назад

      I hope so. cant get this damn update inventory function to work with graphql... I may be stuck here forever :)

    • @Techsithtube
      @Techsithtube  6 лет назад +1

      you can check the network tab to see what post it sending to graphql. maybe :)

  • @alex-front-end
    @alex-front-end 6 лет назад

    Nice video! Thank you!

  • @beholdpain
    @beholdpain 5 лет назад +1

    Thank You!!

  • @srinumajji501
    @srinumajji501 5 лет назад

    thank you Guru

  • @nosheenmuzammil5719
    @nosheenmuzammil5719 6 лет назад

    Really helpful tutorial. Now I have a question. How we will use axios with typescript and what will be the project flow. I have a project in which in have to use Axios and Redux with typescript.

  • @NikhilMahirrao
    @NikhilMahirrao 4 года назад

    How to add static props/values to functional typescript component?
    Ex. HomePage.Header = Header;

  • @SunilKumar-fh6jk
    @SunilKumar-fh6jk 6 лет назад

    Hey sir recently i finished watching your react series, and I really learnt a lot. This is awesome My next step should be learning redux but I read that react's new Context api is really good to learn first. So please make a tutorial on that sir! thank you.

    • @Techsithtube
      @Techsithtube  6 лет назад +2

      I think you can learn redux first . The new context api is still in beta . I am going to release redux videos soon.

    • @SunilKumar-fh6jk
      @SunilKumar-fh6jk 6 лет назад

      Thank you sir. Waiting for your redux series. Please upload soon

  • @erikos93
    @erikos93 6 лет назад +1

    Thanks! :)

  • @srudabdulrahman9608
    @srudabdulrahman9608 6 лет назад +1

    Thank you

  • @salmanzare6194
    @salmanzare6194 6 лет назад +1

    nice

  • @Techwithsatya25
    @Techwithsatya25 4 года назад

    Hello Sir ,thanks a lot for your support
    i get my 1st job .
    i am working on a react project and i have to validate a form using formic ,and code in tsx,but i got stuck in tsx,please suggest me what i have to read ,or if possible please make a video on that
    thank you..

    • @Techsithtube
      @Techsithtube  4 года назад

      Formic is bit easy to learn but using it with tsx can be confusing. I will make a video on it. thanks for suggesting.

  • @searchingname1632
    @searchingname1632 6 лет назад

    Great! I have one question, what is that mean for if i use symbol in type inference ie: class MyClass extends React.Component ....so wht is here for &, | and comma .... please explain. I am beginner.

  • @harrybanda
    @harrybanda 6 лет назад

    Nice

  • @93vipulgarg
    @93vipulgarg 6 лет назад

    You had declared an interface for the state 'MyClassState' for defining the structure of our state object in MyClass.tsx at 9:50. Can you how will we link that interface with this.state ?

  • @kodamin6723
    @kodamin6723 5 лет назад

    Error "JSX element class does not support attributes because it does not have a 'props' property".
    Even though MyClass extends React.Component and MyClassProps defines the properties

    • @kodamin6723
      @kodamin6723 5 лет назад

      Figured it out. My "create-react-app" didn't install everything so I had to run "npm install @types/node @types/react @types/react-dom @types/typescript"

    • @Techsithtube
      @Techsithtube  5 лет назад

      Glad you got it. :)

  • @mohangopals
    @mohangopals 6 лет назад

    Is possible to use babel and typescript in same application?

  • @shunxu
    @shunxu 6 лет назад

    Your text editor seems awesome, would you mind sharing what you are using?

  • @CSniper
    @CSniper 6 лет назад

    It says: "Use an interface instead of a type literal" when using the type in MyComp. How do I resolve this?

  • @andresmontoya7852
    @andresmontoya7852 6 лет назад

    Great! I have one question, the interface of typescript, can replace proptypes?

    • @Techsithtube
      @Techsithtube  6 лет назад +3

      Yes, that is the objective. You wont have to use proptypes if you are using Typescript.

    • @jeffesoncosta14
      @jeffesoncosta14 6 лет назад

      Yes

  • @SlahsVurdonski
    @SlahsVurdonski 6 лет назад +1

    Great vid! Are you rly 21? :o (bcs you know so much)

    • @Techsithtube
      @Techsithtube  6 лет назад +2

      :) Actually I am double that age.

  • @ufukuysal215
    @ufukuysal215 5 лет назад

    if you will take (4,18): interface name must start with a capitalized I error
    open tslint.json
    add
    "rules": {
    "object-literal-sort-keys": false,
    "interface-name": false,
    "member-access": [true, "no-public"],
    "ordered-imports": false
    }
    :((((

    • @icycooldrink6085
      @icycooldrink6085 5 лет назад

      As a general rule, you can just name your interfaces as Isomething (where something is the original name) and the warning won't appear. It seems to simply be a naming convention that they are enforcing now.

  • @tarun-video
    @tarun-video 6 лет назад

    Getting below error:
    D:/Study/React/react-typescript/src/components/MyClass.tsx
    (3,18): interface name must start with a capitalized I

  • @ajaygaur3392
    @ajaygaur3392 5 лет назад

    I read about "target" in compilerOptions in tsconfig but I didn't understand it? What's that for? Also the "module" keyword in tsconfig

    • @Techsithtube
      @Techsithtube  5 лет назад

      browser doesn't understand typescript it only knows JavaScript so you write in typescript and it gets converted to JavaScript . target is noting but what version of JavaScript you want this to be converted to . ES5, ES6 ?

    • @ajaygaur3392
      @ajaygaur3392 5 лет назад

      @@Techsithtube so the target should be es5 and not es6 because browser can better understand es5. Although browser implements almost all the functionality of es6 but in typescript config we should provide es5. Right?

    • @ajaygaur3392
      @ajaygaur3392 5 лет назад

      @techsith I'm using awesome-typescript-loader and babel later so the target could be es6 because babel would convert the es6 to es5. I think it is the version in which my code gets converted to after applying typescript loader but the standard documentation didn't clear up things for me. Please tell if I'm wrong/right

  • @sivareddy8475
    @sivareddy8475 6 лет назад

    Hello Techsith, where can i find more details or purchase course on this project

    • @Techsithtube
      @Techsithtube  6 лет назад

      This course is free. You can watch entire series on react here.

  • @pavandeepkka8472
    @pavandeepkka8472 6 лет назад +1

    i have E:/wind/cat/src/components/Wind.tsx
    (3,18): interface name must start with a capitalized I how its solve

    • @fitwist
      @fitwist 5 лет назад

      the same issue
      try adding ignore rule to tslint like this:
      {
      "extends": ["tslint:recommended", "tslint-react", "tslint-config-prettier"],
      "linterOptions": {
      "exclude": [
      "config/**/*.js",
      "node_modules/**/*.ts",
      "coverage/lcov-report/*.js"
      ]
      },
      "rules": {
      "interface-name":[false]
      }
      }
      The error is not thrown now. But another one appeared: 'Use an interface instead of a type literal'

    • @icycooldrink6085
      @icycooldrink6085 5 лет назад +1

      @@fitwist You can also avoid the "must start with capitalized I but simply naming the interface Isomething. (where something is the original name)
      That latter error I also get and I can't seem to find a way around it. I just can't use type guards as shown in this vid.

  • @axe-z8316
    @axe-z8316 5 лет назад

    your tslint is way different... your code is not valid.

  • @praveenrajkumarchintalapud4595
    @praveenrajkumarchintalapud4595 6 лет назад

    When will you do series on Flux/Redux

  • @MattDuarte11
    @MattDuarte11 6 лет назад

    How do we upload a react app to github?

    • @Techsithtube
      @Techsithtube  6 лет назад

      goto command line in your project directory. and run following commands.
      : git init
      : git add .
      : git commit -m "initial"
      then go git hub and create a new project dont add readme . it will give you two commands like this. run them. as well.
      :git remote add origin github.com/youruser/yourrepo.git
      :git push -u origin master

    • @MattDuarte11
      @MattDuarte11 6 лет назад

      techsith Oh so it’s the same as Angular! Wow thank you sir. Also do you have a tutorial on setting up backend with node express and mongo?

  • @alex-front-end
    @alex-front-end 6 лет назад

    Guys, anyone knows how to provide source maps support for css/sass with a such sort of setup (without eject)? Thanks in advance if you'll "save my life" with any clue! )

  • @nahombiniam3790
    @nahombiniam3790 6 лет назад

    can you provide us with real examples

  • @GifCoDigital
    @GifCoDigital 5 лет назад

    When you cant even import a module properly I cant really trust the rest of the tut. Either start over or edit the bloody video