API
Future API
@stackflow/config

@stackflow/config

Config

  • Introduce the concept of Config in Stackflow.
  • Allows static declaration of activities without React dependency.

You can write as follows.

stackflow.config.ts
import { defineConfig } from "@stackflow/config";
 
export const config = defineConfig({
  activities: [
    {
      name: "HomeActivity",
    },
    {
      name: "MyProfileActivity",
    }
  ],
  transitionDuration: 270,
});
💡

Now, when additional configuration is needed in a plugin, you can extend @stackflow/config to receive the necessary information for the plugin's operation, not just through the plugin function's parameters.

decorate API

You can extend the Config type as follows to utilize config in various places.

declare module "@stackflow/config" {
  interface Config<T extends ActivityDefinition<string>> {
    relayEnvironment: RelayEnvironment;
  }
}
 
config.decorate("relayEnvironment", myRelayEnvironment);

API

OptionTypeDescription
activitiesActivityDefinition<string>[]An array of activities.
transitionDurationnumberDuration of the transition animation.
initialActivity() => ActivityDefinition<string>["name"]The initial activity.