github remix-run/remix route-pattern@0.8.0
route-pattern v0.8.0

latest releases: route-pattern@0.10.0, route-pattern@0.9.1, route-pattern@0.9.0...
2 days ago
  • Any valid pattern is also valid in href(pattern)
  • Href generation with missing optional variables omits the optional section entirely
let href = createHrefBuilder()
href('products(/:id)', { id: 'remix' }) // /products/remix

// These all used to fail, but are now OK!
href('products(/:id)') // /products
href('products(/:id)', {}) // /products
href('products(/:id)', { id: null }) // /products (type error)
href('products(/:id)', { id: undefined }) // /products (type error)
  • Param values may be string | number | bigint | boolean and are automatically stringified
let href = createHrefBuilder()

// These used to be a type errors, but are now OK!
href('products(/:id)', { id: 1 }) // /products/1
href('products(/:id)', { id: false }) // /products/false

Don't miss a new remix release

NewReleases is sending notifications on new releases.