📜  generatePath - Javascript 代码示例

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

代码示例1
// React Router v6:
// interpolates set of params into a route path string
// with ':id' & '*' placeholders.

generatePath('/users/:id', { id: 42 });
// --> '/users/42'

generatePath('/files/:type/*', {
  type: 'img',
  '*': 'cat.jpg'
})
// --> '/files/img/cat.jpg'