Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

useRouteMatch

// React Router v5:
// hook without argument returns match obj of current <Route>
// or takes obj argument identical to 'props' argument of matchPath
import { useRouteMatch } from 'react-router-dom'

function BlogPost() {
 let match = useRouteMatch({ 
   '/blog/:slug', 
   strict: true, 
   sensitive: true 
 })
 // Do something with the match...
 return <div />
}
Source by v5.reactrouter.com #
 
PREVIOUS NEXT
Tagged: #useRouteMatch
ADD COMMENT
Topic
Name
9+9 =