Sanity Library Reference Docs
    Preparing search index...

    Function StateLink

    • A component that creates a link that updates the URL state.

      Parameters

      • props: StateLinkProps & Omit<HTMLProps<HTMLAnchorElement>, "href"> & RefAttributes<
            HTMLAnchorElement,
        >

        Props to pass to the StateLink component. See StateLinkProps.

      Returns Element

      This component uses the useStateLink hook to create a link that updates the URL state.

      function MyComponent() {
      return <StateLink state={{foo: 'bar'}}>Link</StateLink>
      }