@stackflow/plugin-map-initial-activity
This plugin is used to map the initial activity using the given URL.
Installation
npm install @stackflow/plugin-map-initial-activity
Usage
import { stackflow } from "@stackflow/react";
import { mapInitialActivityPlugin } from "@stackflow/plugin-map-initial-activity";
const { Stack, useFlow } = stackflow({
activities: {
// ...
},
plugins: [
mapInitialActivityPlugin({
mapper(url) {
// implement mapping logic using url parameter
return {
activityName: "...",
activityParams: {},
};
},
}),
],
});
Reference
Options
Option | Type | Description |
---|---|---|
mapper | (url: URL) => { activityName: string; activityParams: {}; } | null | A function that takes a URL and returns an object with the activity name and parameters, or null if no match. |