-1
我遇到了一个问题,我的按钮点击未在我的应用程序中触发。我正在尝试使用简单的hapi服务器的React。我使用hapi-react-views节点包进行渲染。关于我在这里做错的任何想法?下面的一些代码。与hapi-react-views反应应用程序点击不能触发
const React = require('react');
import { Jumbotron, Button } from 'react-bootstrap';
class HomeView extends React.Component {
constructor(props) {
super(props);
// This binding is necessary to make `this` work in the callback
this.buttonClicked = this.buttonClicked.bind(this);
}
buttonClicked() {
console.log('you clicked something');
}
render() {
return (
<div>
<Button onClick={this.buttonClicked} bsStyle="success">Test Button</Button>
</div>
);
}
}
module.exports = HomeView;
你的代码看起来很好,你想干什么?你有错误吗? – Freez