我是本机反应的新手。这是App.js的一部分
<Button
title="LOGIN"
onPress={() =>
{
{{this.componentDidMount(this.state.city)}}
}
}
/>
我想将“ this.state.city”发送到我的其他js文件“ Form.js”。
这是'Form.js'
import React from 'react';
import { FlatList, ActivityIndicator, Text, View } from 'react-native';
class Form extends React.Component {
constructor(props){
super(props);
this.state ={ isLoading: true}
}
componentDidMount(){
const api_key="there_is_an_api_key";
const city="ankara"
// I want that variable here
谢谢您的帮助