React Bug Fiddle (JSX)
this.refs is a reserved word?
by Felis Catus
HTML
<script src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<div id="container">
<!-- This element's contents will be replaced with your component. -->
</div>
Babel + JSX
class Hello extends React.Component {
render() {
return <div>Hello {this.props.name}; Test: {this.refs&&this.refs.test||'successful'}, Test2: {this.irefs&&this.irefs.test||'not ok'}</div>;
}
constructor(props){
super(props);
this.refs={
test: 'fail'
}
this.irefs={
test: 'ok'
}
}
}
ReactDOM.render(
<Hello name="World" />,
document.getElementById('container')
);