SAP UI5 Web Component React應用如何在Component之間跳轉

i042416發表於2020-02-20

假設我要從React的home Component跳轉到detail Component.


在home Component裡,定義一個點選事件處理函式:

SAP UI5 Web Component React應用如何在Component之間跳轉

其實現原始碼如下:

SAP UI5 Web Component React應用如何在Component之間跳轉

```JavaScript

 const history = useHistory();
  const handleProgressHeaderClick = () => {
    history.push("/detail");
  };

```

測試:點選Progress list後,注意觀察url和顯示區域的變化:

SAP UI5 Web Component React應用如何在Component之間跳轉 SAP UI5 Web Component React應用如何在Component之間跳轉


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2676310/,如需轉載,請註明出處,否則將追究法律責任。

相關文章