e后
<html>
<head>
<title>Document</title>
<script src="../react.js"></script>
<script src="../react-dom.js"></script>
<script src="http://cdn.bootcss.com/babel-core/5.8.38/browser.min.js"></script>
</head>
<body>
<div id="demo"></div>
<script type="text/babel"> class Popper extends React.Component { constructor(props) { super(props) this.state = {name: 'wlh'} } preventPop(name, e) { e.preventDefault() alert(name) } render() { return ( <a href="https://reactjs.org" onClick={this.preventPop.bind(this, this.state.name)}> Click </a> ) } } const element = <Popper /> ReactDOM.render( element, document.getElementById('demo') ) </script>
</body>
</html>