Resolving Circular References with useFlow
In Stackflow 2.0, useFlow() and useStepFlow() are imported directly from @stackflow/react, so circular reference issues no longer occur in most cases.
If you are building a custom wrapper around useActions() and need to reference activity types, you can export the type from your stackflow setup:
stackflow.ts
import { stackflow } from "@stackflow/react";
import { config } from "./stackflow.config";
export const { Stack } = stackflow({
config,
components: {
// ...
},
});useMyFlow.ts
import { useActions } from "@stackflow/react";
import { config } from "./stackflow.config";
export const useMyFlow = () => {
return useActions(config);
};💡
For the common case of navigating between activities, simply use useFlow() imported directly from @stackflow/react — no wrapper needed.