[Poi] Customize Babel to Build a React App with Poi

Developing React with Poi is as easy as adding the babel-preset-react-appto a .babelrc and installing React. This lesson will walk you through that quick process and get your React app up-and-running.

 

Install:

npm i react react-dom babel-preset-react-app babel-plugin-react-require

 

.babelrc:

{
    "presets": [
       "react-app"
    ],
    "plugins": [
       "react-require"
    ]
}

 

index.js:

// import React from 'react'; // NO NEED because babel-plugin-react-require

import {render} from 'react-dom';

render(<h1>React</h1>, document.getElementById("app"))

 

Run:

poi

 

posted @ 2018-01-03 03:10  Zhentiw  阅读(162)  评论(0编辑  收藏  举报