📜  useMatch - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:49.104000             🧑  作者: Mango

代码示例2
// React Router v6: 
// hook returns match data about a route 
// at given path relative to current location
import { useMatch } from 'react-router-dom'

function BlogPost() {
 let match = useMatch({ 
   '/blog/:slug', 
   end: true, 
   caseSensitive: true 
 })
 // Do something with the match...
 return 
} // React Router v5 import { useRouteMatch } from 'react-router-dom' function BlogPost() { let match = useRouteMatch({ '/blog/:slug', strict: true, sensitive: true }) // Do something with the match... return
}