一、分别使用jspm和npm安装使用React

使用命令 jspm install react 进行安装

使用命令 jspm install react-dom 安装 react-dom

使用命令 jspm install semantic-ui 进行 semantic-ui样式的安装(不是必须)

使用 jspm install css 进行插件的安装

然后使用 命令 browser-sync start --server --no-notify --file 'index.html, app/**/*.js' 来监视文件的变化

打开app文件夹下的mian.js

使用 import 导入 semantic.min.css

然后打开index.html页面

<!DOCTYPE HTML>
<html lang="zh-hans">

<head>
    <meta charset="UTF-8">
    <title>journey React</title>
</head>
<body>
    <div class="ui container" style="padding:10px">
        <button class="ui green button">hello</button>
    </div>
    <script src="jspm_packages/system.js"></script>
    <script src="config.js"></script>
    <script>
        System.import('app/main');
    </script>
</body>

</html>

刷新浏览器,可以看到semantic效果的按钮

 $ npm install react --save $ npm install react-dom --save

 

 

$ npm install babel-core $ npm install babel-loader $ npm install babel-preset-react $ npm install babel-preset-es2015

posted @ 2018-01-22 21:48  journeyIT  阅读(14)  评论(0编辑  收藏  举报