LocaleLink

Locale aware <Link /> component for routing. See here for <Link /> documentation.

Ensure <LocaleLink /> is rendered within createPage([...connectArgs])(Page, [reducers]) hierarchy.

Props

  • href (String|URL Object): Path section of URL.

  • [as] (String|URL Object): Actual path (including the query) shows in the browser.

  • [locale] (String): A locale string, e.g. id-id, en-id, etc.

  • [passHref] (Boolean): Passes href to <a> child that doesn't have href attribute.

  • [prefetch] (Boolean): Allows all the future interaction paths of your app to be instant.

  • [replace] (Boolean): Uses replace state instead of the default push state.

  • [shallow] (Boolean): Allows changing URL without running getInitialProps.

Examples

Basic usage

import LocaleLink from 'soya-next/link';

export default () => (
  <LocaleLink href="/">
    <a>Home</a>
  </LocaleLink>
);

Overriding locale

Passing href attribute to <a>

Last updated