Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://npmcdn.com/bootstrap@4.0.0-alpha.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser-polyfill.js"></script>
    <script type="text/javascript" src="https://npmcdn.com/react@15/dist/react-with-addons.js"></script>
    <script type="text/javascript" src="https://npmcdn.com/react-dom@15/dist/react-dom.js"></script>
    <script src="https://npmcdn.com/reactstrap@2/dist/reactstrap.min.js"></script>
  
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <div id="app"></div>
</body>
</html>
 
html, body {
  height: 100%;
  width: 100%;
}
body {
  padding: 2rem;
}
 
const {
  Button,
  Form
} = Reactstrap;
class HelloWorldComponent extends React.Component {
  constructor(props) {
    super(props);
    
    this.formPreventDefault = this.formPreventDefault.bind(this);
    this.onClickPreventDefault = this.onClickPreventDefault.bind(this);
  }
  
  // handler recieves the `e` event object
  formPreventDefault(e) {
    alert('here');  
    e.preventDefault();
  }
  
  onClickPreventDefault(e) {
    alert('onClickPreventDefault called, form will not submit');
    e.preventDefault();
  }
 
  
  render() {
    return (      
      <div>
        <Form onSubmit={this.formPreventDefault}>
         <div>
          <h3>Buttons</h3> 
          <p>
            <Button color="primary">formPreventDefault</Button>&nbsp;
          </p>
        </div>
       </Form>
       <hr/>
       <Form>
         <div>
          <h3>Buttons</h3> 
          <p>
            <Button color="primary" onClick={this.onClickPreventDefault}>onClickPreventDefault</Button>&nbsp;
          </p>
        </div>
       </Form>
      </div>
    );
  }
}
ReactDOM.render(
  <HelloWorldComponent name="Joe Schmoe"/>,
  document.getElementById('app')
);
Output 300px

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
eddywasherepro
0viewers