Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

from how many ways we can define props with typescript react

1interface OptionalMiddleName {
2    firstName: string;
3    middleName?: string;
4    lastName: string;
5}
6function Component({firstName, middleName = "N/A", lastName}:OptionalMiddleName){
7    // If middleName wasn't passed in, value will be "N/A"
8}
Source by www.pluralsight.com #
 
PREVIOUS NEXT
Tagged: #ways #define #props #typescript #react
ADD COMMENT
Topic
Name
6+4 =