使用SAP UI5 Web Components开发React应用

2020-03-31 07:48:18  阅读:-  来源:

(1) 命令行 npx create-react-app my-app --template @ui5/cra-template-webcomponents-react


创建名为my-app的react应用,并安装对应的依赖。


成功执行后,会看到Success! Created my-app at XXXX的提示信息:

使用SAP UI5 Web Components开发React应用


使用SAP UI5 Web Components开发React应用

进入my-app项目的src文件夹里,新建MyApp.jsx:


使用SAP UI5 Web Components开发React应用

import React from "react";


export function MyApp() {

return

My root component
;

}


在App.js里导入这个Component:

使用SAP UI5 Web Components开发React应用

npm start

使用SAP UI5 Web Components开发React应用

浏览器里输入localhost:3000, 就能看到这个最简单的React应用了:

使用SAP UI5 Web Components开发React应用