zl程序教程

您现在的位置是:首页 >  移动开发

当前栏目

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

AppReact to with build POI babel
2023-09-14 08:59:17 时间

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