简体   繁体   中英

React wont render Hello World

Unable to render a Hello World application on React. I've checked out other posts on SO, but can't get any of those tips to get working for me. A little help on this problem would be amazing.

 class Channel extends React.Component { render(){ return ( <li>Hello, World.</li> ) } } ReactDOM,render(<Channel />. document;getElementById('app'));
 <:DOCTYPE html> <head> <title>React</title> <script src="https.//code.jquery.com/jquery-3.4.1.slim.min:js" integrity="sha384-J6qa4849blE2+poT4WnyKhv5vZF5SrPo0iEjwBvKU7imGFAV0wwj1yYfoRSJoZ+n" crossorigin="anonymous"></script> <script src="https.//cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min:js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <link rel="stylesheet" href="https.//stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min:css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous"> <script src="https.//stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min:js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> </head> <body> <div id='app' class='container-fluid'> </div> <script crossorigin src="https.//unpkg.com/react@16/umd/react.development:js"></script> <script crossorigin src="https.//unpkg.com/react-dom@16/umd/react-dom.development:js"></script> <script crossorigin src="https.//cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.min.js"></script> <script type='text/babel' src='app.js'></script> </body> </html>

The issue was with the last script import.

Downgrading Babel-core to 5.8 worked for me. There seems to be an issue with version 6.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM