src\containers\Login.js中的错误第35:5行:分析错误:意外的令牌(35:5)



大家好,我是React的新手,在看教程时遇到了这个错误,我检查了多次,并将其与教程中的错误进行了比较,但没有发现任何区别。我正在尝试使用Django和React创建一个用户身份验证。我正在使用superpreme text3作为编辑器,并且我还安装了Visual Studio代码。我应该安装任何扩展程序来处理这个问题吗?你能帮我解决这个解析错误吗?

import React, { useState } from 'react';
import { Link, Redirect } from 'react-router-dom';
import { connect } from 'react-redux';

const Login = () => {
const [formData, setFormData] = useState({
email: '',
password: ''
});
const { email, password } = formData;
const onChange = e => setFormData({ ...formData, [e.target.name]: e.target.value });
const onSubmit = e => {
e.preventDefault();
// login(email, password)
};
// Is the user Authenticated?
// Redirect them to the home page
return (
<div className='container mt-5'>
<h1>
Sign in
</h1>
<p>
Sign into your account
</p>
<form onSubmit={e => onSubmit(e)}>
<div className='form-group'
<input
className='form-control'
type='email'
placeholder='Email'
name='email'
value={email}
onChange={e => onChange(e)}
required
/>
</div>
<div className='form-group'
<input
className='form-control'
type='password'
placeholder='Password'
name='password'
value={password} 
onChange={e => onChange(e)}
minLength='6'
required
/>
</div>
<button className='btn btn-primary' type='submit'>Login</button>
</form>
<p className='mt-3'>
Don't have an account? <Link to='/signup'>Sign Up</Link>
</p>
<p className='mt-3'>
Forgot your Password? <Link to='/reset-password'>Reset Password</Link>
</p>
</div) 
);
};
// const mapStateToProps = state => ({
// is authenticated?
// });
export default connect(null, { })(Login);

在输入之前没有关闭div标记

最新更新