[React Fundamentals] Development Environment Setup
In this lesson we'll setup a simple build process for converting our ES6 React components into ES5 using Babel and Webpack
Install:
- npm i --save react react-dom
- npm i -D babel-loader babel-core babel-preset-es2015 babel-preset-react
- npm i -g babel webpack webpack-dev-server
Create files:
- touch App.js main.js webpack.config.js
Webpack.config.js:
- module.exports = {
- entry: './main.js',
- output: {
- path: './',
- filename: "index.js"
- },
- devServer: {
- inline: true,
- port:
- },
- module: {
- loaders: [
- {
- test: /\.jsx?$/,
- exclude: /(node_modules|bower_components)/,
- loader: 'babel',
- query: {
- presets: ['es2015', 'react']
- }
- }
- ]
- }
- };
index.html
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>Setup</title>
- </head>
- <body>
- <div id="app"></div>
- <script src="index.js"></script>
- </body>
- </html>
App.js:
- import React from 'react';
- export default class App extends React.Component {
- render() {
- return (
- <span>Hello React</span>
- )
- }
- }
main.js:
- import React from 'react';
- import ReactDOM from 'react-dom';
- import App from './App';
- ReactDOM.render(<App />, document.getElementById('app'));
Run:
- webpack-dev-server
[React Fundamentals] Development Environment Setup的更多相关文章
- [Flux] 1. Development Environment Setup
Install packages: { "name": "reactflux", "version": "1.0.0", ...
- Azure Sphere Development Environment Setup
1. Visual Studio 目前,Visual Studio 2017/2019支持Azure Sphere开发,后续,微软会加入Visual Studio Code的支持.以Visual St ...
- Setup iOS Development Environment.
Setup iOS Development Environment Install XCode and check-out source code from SVN XCode Please find ...
- The Google Test and Development Environment (持续更新)
最近Google Testing Blog上开始连载The Google Test and Development Environment(Google的测试和开发环境),因为blogspot被墙,我 ...
- Programming in Go (Golang) – Setting up a Mac OS X Development Environment
http://www.distilnetworks.com/setup-go-golang-ide-for-mac-os-x/#.V1Byrf50yM8 Programming in Go (Gola ...
- How to set up Dynamics CRM 2011 development environment
Recently I have been starting to learn Microsoft Dynamics CRM 2011 about implement plugin and workfl ...
- Struts 2 - Environment Setup
Our first task is to get a minimal Struts 2 application running. This chapter will guide you on how ...
- Create A .NET Core Development Environment Using Visual Studio Code
https://www.c-sharpcorner.com/article/create-a-net-core-development-environment-using-visual-studio- ...
- Install Qualcomm Development Environment
安裝 Android Development Environment http://www.cnblogs.com/youchihwang/p/6645880.html 除了上述還得安裝, sudo ...
随机推荐
- bzoj列表2
之前发过一次了,这里的题较水,没什么好讲的 bzoj1088 直接穷举前两位即可,话说程序员的扫雷是白玩的? bzoj1083 裸的最小生成树(最小生成树=最小瓶颈树),SCOI大丈夫(话说网上二分是 ...
- input之placeholder与行高的问题。
我们实现一个输入框的视觉的时候为了保持其各种各样的兼容性: 1.鼠标要跟文字一样高度. 2.文字要居中对齐. 3.还要有placeholder 第一个目标,当实现一个高度为40像素的高度输入框时,为了 ...
- JQuery安全分析
JQuery安全分析: JQuery的风险均来源于对输入的数据没有进行有效性检验.客户端的Javascript需要检验:来源于服务器的数据.来源于当前页面的用户输入,服务器端需要检验来源于用户端的数据 ...
- textview的上下滑动效果
1.xml文件中 <TextView … android:scrollbars="vertical" ../> 2.java文件中 textview.se ...
- JDK版本1.6和6.0到底指什么
Both version numbers (1.6.0 and 6) are used to identify this release of the Java Platform. Version 6 ...
- Java [leetcode 21]Merge Two Sorted Lists
题目描述: Merge two sorted linked lists and return it as a new list. The new list should be made by spli ...
- spring的三种注入方式
接口注入(不推荐) 构造器注入(死的应用) getter,setter方式注入(比较常用) Type1 接口注入 我们常常借助接口来将调用者与实现者分离.如: public class ClassA ...
- linux 学习之 rpm
目前最常见的两种软件安装方式: 1.dpkg 2.rpm 1.dpkg 最早是由Debian Linux社群开发出来的,通过dpkg,Debian提供的软件就可以简单的安装,同时还能提供安装后的软件信 ...
- 【译】 AWK教程指南 8处理多行数据
awk 每次从数据文件中只读取一行数据进行处理.awk是依照其内置变量 RS(Record Separator) 的定义将文件中的数据分隔成一行一行的Record.RS 的默认值是 "\n& ...
- 如何制作网页小动画?——gif or png
一.场景与动画 为了拉动网站氛围,或者吸引用户浏览焦点,需要使用一些小动画.这种动画不是(gif)单纯的重复,而是需要需要一些控制和交互,比如在动画完成后打开一个对话框.动画有几个基本要素(时间控制, ...