react獲取當前頁面的url參數

react獲取當前頁面的url參數,必須在url路由對應的組件上獲取,在子組件上獲取不到,爲undefined,獲取形如  /news/:id  的後面的參數 idreact this.props.match.params.id 獲取形如 /news?id="abc"的  ?id="abc"  部分,post this.props.location.search
相關文章
相關標籤/搜索