今天在浏览器调试react的时候报错
const style = {
'color': 'red',
'fontSize': '46px'
};
const clickHandler = () => alert('hi');
ReactDOM.render( < h1 style = {
style
}BfwOnclick= {
clickHandler
} > Hello, world!</h1>,
document.getElementById('example')
);Unexpected token '<' Error
请问大神怎么解决?
网友回复
需要用到
babel
将script type改为type = "text/babel",更改后如下,另外还要引入babel
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/babel.min.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/react.production.16.13.js"></script>
<script type="text/ja...点击查看剩余70%


