天天看點

使用SAP UI5 Web Components開發React應用

(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() {undefined

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應用