【发布时间】:2018-11-13 18:44:32
【问题描述】:
我只想在https://github.com/react-boilerplate/react-boilerplate/中添加jsx页面
下面是我要添加的密码忘记页面jsx文件内容。
import React from 'react';
import { connect } from 'react-redux';
import {Link, Route} from 'react-router-dom';
class PwdForgotPage extends React.Component {
render() {
return (
<div className="col-md-6 col-md-offset-3">
Password forgot.
<button className="btn btn-link">Back</button>
</div>
);
}
}
function mapStateToProps(state) {
const { registering } = state.registration;
return {
registering,
};
}
const connectedPwdForgotPage = connect(mapStateToProps)(PwdForgotPage);
export { connectedPwdForgotPage as PwdForgotPage };
但如果我使用 jsx 扩展,则无法运行如下。
Module parse failed: C:\.....\frontend\app\containers\PwdForgotPage\PwdForgotPage.jsx Unexpected token (8:6)
You may need an appropriate loader to handle this file type.
| render() {
| return (
| <div className="col-md-6 col-md-offset-3">
| Password forgot.
| <button className="btn btn-link">Back</button>
如果我使用 js 扩展,它可以工作。 如何更改样板文件中的配置以支持 jsx 扩展?
【问题讨论】:
标签: reactjs redux jsx boilerplate