Answer the question
In order to leave comments, you need to log in
React Native. What does this declaration Component and function (data: Object): {[name: string]: number} {} mean?
I opened someone else's Js code in the React Native project and saw such a function declaration there.
How many searched did not find an explanation.
1)
When creating a pure React project.
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>
Welcome to React Native!
</Text>
<Text style={styles.instructions}>
To get started, edit App.js
</Text>
<Text style={styles.instructions}>
{instructions}
</Text>
</View>
);
}
}
export function create(data: Object): {[name: string]: number} {}
Answer the question
In order to leave comments, you need to log in
It's not just JavaScript, but TypeScript or Flow.
type props = {}is a type alias. More details in the documentation: www.typescriptlang.org/docs/handbook/advanced-type... or https://flow.org/en/docs/types/aliases/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question