I come to react (as well as react-native) with typescript, of course, I'm a beginner, so soon my company assigns me to support a javascript project, and I have javascript questions
In typescript, if we want to use props, I think the best, also cool way to do that is using Interface, it also let me have IntelliSense code in vs code
export interface FooI {
some: string;
propsA: string;
here: number;
}
And use that in component:
export default function Bar(props: FooI) {
const {some, propsA, here} = props;
}
And we also can inherit react component( in this case is react-native), so if I want the component will be a button, so I add
export interface FooI extends ButtonProps {
some: string;
propsA: string;
here: number;
}
As I know we don't have that in javascript, so what is similar to the interface in javascript so I can create a custom component like above and vs code will recognize that and show an auto-complete pop-up?