Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="//fb.me/react-0.13.1.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  <svg style="display: none">
    <rect id="icon" width="100" height="100"></rect>
  </svg>
  
  <div id="react"></div>
  ^ This SVG <rect> does not!
</body>
</html>
 
#text {
  display: block;
  position: relative;
  top: 20px;
  color: white;
}
 
var Icon = React.createClass({
  render: function() {
    return <svg height="100" dangerouslySetInnerHTML={{__html: '<use xlink:href="#icon"></use>'}} />;
  }
});
var Clicker = React.createClass({
  cancelNavigation: function(evt) {
    evt.preventDefault();
  },
  render: function() {
    return (
      <a href="https://google.com" onClick={this.cancelNavigation}>
        <div id="text">I get canceled!</div>
        <Icon />
      </a>
    )
  }
});
React.render(<Clicker />, document.getElementById('react'));
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers