reactjs

如何安装reactjs

日期:2019-06-25 阅读:93

直接引用 https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Hello World</title>
    <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>
    
    <!-- Don't use this in production: -->
    <script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
  </head>
  <body>
    <div id="root"></div>
    <script type="text/babel">

      ReactDOM.render(
        <h1>Hello, world!</h1>,
        document.getElementById('root')
      );

    </script>
 
  </body>
</html>

-----------------------

也可以通过npm安装

npx create-react-app my-app
cd my-app
npm start

https://www.reactjscn.com/docs/create-a-new-react-app.html

--------------------

 

<<点击返回