Framework
Version

Link options

linkOptions is a function which type checks an object literal with the intention of being used for Link, navigate or redirect

linkOptions props

The linkOptions accepts the following option:

...props

  • Type: LinkProps & React.RefAttributes<HTMLAnchorElement>
  • LinkProps

linkOptions returns

An object literal with the exact type inferred from the input

Examples

tsx
const userLinkOptions = linkOptions({
  to: '/dashboard/users/user',
  search: {
    usersView: {
      sortBy: 'email',
      filterBy: 'filter',
    },
    userId: 0,
  },
})

function DashboardComponent() {
  return <Link {...userLinkOptions} />
}
const userLinkOptions = linkOptions({
  to: '/dashboard/users/user',
  search: {
    usersView: {
      sortBy: 'email',
      filterBy: 'filter',
    },
    userId: 0,
  },
})

function DashboardComponent() {
  return <Link {...userLinkOptions} />
}
Subscribe to Bytes

Your weekly dose of JavaScript news. Delivered every Monday to over 100,000 devs, for free.

Bytes

No spam. Unsubscribe at any time.