我对我的收藏品没有独特的约束,也无法添加它。在//first.js
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
Image,
TextInput,
Button,
TouchableHighlight
} from 'react-native';
export default class Home extends Component {
constructor(props){
super(props);
this.state = {zipCode: ''}
}
navigate = (zipCode) => {
this.props.navigation.navigate('Search', zipCode);
}
render() {
return (
<View>
<View>
<Text>An application to do things</Text>
<TextInput
placeholder='Enter a Zip Code'
onChangeText={(zipCode) => this.setState({zipCode})}
>
</TextInput>
</View>
<View>
<TouchableHighlight onPress={() => this.navigate(this.state.zipCode)}>
<Text>
Search
</Text>
</TouchableHighlight>
</View>
</View>
);
}
}
上,在某些未知情况下,mongodb会创建重复记录。
有关这种情况如何以及为何发生的任何想法?