我有两个文件,第一个是todoHelper.js
它有 export const addTodo = (list, item) => [...list, item]
后来我想addTodo在另一个文件中使用,我只是这样做import {addTodo} from './todoHelpers'
但我也看到人们做出口违约而不仅仅是出口.有什么区别?
unused default export每当我将鼠标悬停export default emailChanged;在我的index.js文件中时,我都不明白我是如何出错的。我假设这就是我的代码无法在模拟器中运行的原因。
这是LoginForm.js:
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {emailChanged} from 'TorusTeensApp/src/actions';
import {Text, StyleSheet, KeyboardAvoidingView, TextInput, TouchableOpacity} from 'react-native';
class LoginForm extends Component {
onEmailChange(text) {
this.props.emailChanged(text);
}
render() {
return(
<KeyboardAvoidingView style={styles.container}>
<TextInput
style={styles.userInput}
onsubmitediting={() => this.passwordInput.focus()}
returnKeyType={"next"}
placeholder={"Email"}
label={"Email"}
keyboardType={"email-address"}
autoCorrect={false}
onChangeText={this.onEmailChange.bind(this)}
value={this.props.email}
/>
<TextInput
style={styles.userInput}
ref={(userInput) => this.passwordInput = userInput}
returnKeyType={"go"}
placeholder={"Password"}
label={"Password"}
secureTextEntry
/>
<TouchableOpacity style={styles.buttonContainer}>
<Text style={styles.buttonText}>Login</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.buttonContainer}> …Run Code Online (Sandbox Code Playgroud)