Tuesday, June 7, 2022
HomeWordPress DevelopmentWhy I all the time "advocate" for typescript 😊

Why I all the time “advocate” for typescript 😊


Howdy world, 😊
Did you take a look at my typescript todo-list-app



Why I desire typescript

Checking a selected worth’s sort at runtime is the first perform of sort guards. This helps the TypeScript compiler, which then makes use of the knowledge to develop into extra predictive concerning the sorts.

I used to be creating this very platform melbite.com CRUD operations, as ordinary we’ve got to move Props when utilizing react. My props consisted of Numbers, Strings and even Boolean and I used to be working out of time.



How I Mounted it.

Take an instance under, you will have replace consumer profile part,

<UpdateProfile />
Enter fullscreen mode

Exit fullscreen mode

And also you need to move props like username & age, you first must outline your interface props like this,

interface UserData {
username: string,
age: quantity
}
Enter fullscreen mode

Exit fullscreen mode

Then your <UpdateProfile/> part ought to me wanting like this,

const UpdateProfile: FC = (props): JSX.Factor => {
  <>

  </>
};
Enter fullscreen mode

Exit fullscreen mode

Then move your props like this,

const UpdateProfile: FC = (props): JSX.Factor => {
  <>
    {props.username}
    {props.age}
  </>
};
Enter fullscreen mode

Exit fullscreen mode



Recap

Passing props with Javascript would possibly trigger pointless bugs in your utility.
I’d advocate each developer to strive typescript 😊

You possibly can take a look at my typescript todo-list-app

And say 👋 in case you discover this useful and my web site enticing 😊 https://melbite.com

Article initially revealed at melbite.com/why-i-always-advocate-for-typescript

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments