Files
xyflow/examples/react/src/generic-tests/index.tsx
T
2023-11-08 17:44:51 +01:00

18 lines
466 B
TypeScript

import { useLocation } from 'react-router-dom';
import Flow from './Flow';
const flowConfigs = import.meta.glob<FlowConfig>('./**/*.ts', { eager: true, import: 'default' });
export default () => {
const location = useLocation();
const path = `.${location.pathname.replace('/tests/generic', '')}.ts`;
const flowConfig = flowConfigs[path];
if (!flowConfig) {
return `404: This route doesn't exists.`;
}
return <Flow flowConfig={flowConfig} />;
};