April 23, 2023 React Get slug from url in react js Posted by toihid const url = window.location.href; const slug = url.substring(url.lastIndexOf('/') + 1);