@stackflow/link
TypeScript icon, indicating that this package has built-in type declarations

1.4.5 • Public • Published

@stackflow/link

It mimics the <Link /> component behavior provided by Gatsby or Next.js.

Dependencies

It can be used only when both @stackflow/plugin-history-sync and @stackflow/plugin-preload are set.

  • @stackflow/plugin-history-sync
  • @stackflow/plugin-preload

Usage

/**
 * stackflow.ts
 */
import { stackflow } from "@stackflow/react";
import { historySyncPlugin } from "@stackflow/plugin-history-sync";
import { preloadPlugin } from "@stackflow/plugin-preload";

const { Stack, useFlow, activities } = stackflow({
  activities: {
    // ...
  },
  plugins: [
    historySyncPlugin({
      //...
    }),
    preloadPlugin({
      // ...
    }),
    // ...
  ],
});

export type TypeActivities = typeof activities;
/**
 * Link.ts
 */
import { createLinkComponent } from "@stackflow/link";
import type { TypeActivities } from "./stackflow";

export const { Link } = createLinkComponent<TypeActivities>();
/**
 * MyComponent.ts
 */
import { Link } from './Link'

const MyComponent = () => {
  return (
    <div>
      <Link
        className={...}
        activityName="MyActivity"
        activityParams={{}}
      >
        {/* ... */}
      </Link>
    </div>
  )
}

Readme

Keywords

none

Package Sidebar

Install

npm i @stackflow/link

Weekly Downloads

465

Version

1.4.5

License

MIT

Unpacked Size

36.7 kB

Total Files

21

Last publish

Collaborators

  • orionmiz
  • irrationnelle
  • tonyfromundefined