Skip to content

copied from react-router-dom to use anywhere for generating path from string

Notifications You must be signed in to change notification settings

danish-khan-I/generatePath

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

generatePath

easily create urls from string

Example

import generatePath from './generatePath'
const urls = {
home: '/',
blog : '/blog/:title/:year/:month'
}
generatePath(urls.blog,{
  title: 'some-cool-title',
  year: new Date().getFullYear(),
  month: new Date().getMonth() + 1
})

// output: /blog/some-cool-title/2021/10

About

copied from react-router-dom to use anywhere for generating path from string

Resources

Stars

Watchers

Forks

Packages

No packages published