React获取当前页面路由路径

获取当前页面路由路径:

const urlParams = new URL(window.location.href);
const pathname = urlParams?.pathname;
console.log("pathname:", pathname);

扫描下方二维码,关注公众号:程序进阶之路,实时获取更多优质文章推送。


扫码关注

评论