Skip to content

Commit 105f15f

Browse files
committed
feat(@app/react-fe): hide complex instanciation behind a factory
1 parent 2273adf commit 105f15f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import { InMemoryExampleAggregateRepository } from '@src/example-aggregate/infrastructure/inMemoryExampleAggregateRepository';
2+
import { ExampleAggregateList } from '@src/example-aggregate/sections/list/exampleAggregateList';
3+
4+
const repository = new InMemoryExampleAggregateRepository();
5+
6+
export function ExampleAggregateListFactory() {
7+
return <ExampleAggregateList repository={repository} />;
8+
}

src/apps/example-context/react-frontend/src/router.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
import { InMemoryExampleAggregateRepository } from '@src/example-aggregate/infrastructure/inMemoryExampleAggregateRepository';
2-
import { ExampleAggregateList } from '@src/example-aggregate/sections/list/exampleAggregateList';
1+
import { ExampleAggregateListFactory } from '@src/example-aggregate/sections/list/exampleAggregateListFactory';
32
import { Layout } from '@src/layout/sections/layout';
43
import { RouterProvider, createBrowserRouter } from 'react-router-dom';
54

6-
const repository = new InMemoryExampleAggregateRepository();
7-
85
const router = createBrowserRouter([
96
{
107
path: '/',
118
element: <Layout />,
129
children: [
1310
{
1411
path: '/',
15-
element: <ExampleAggregateList repository={repository} />
12+
element: <ExampleAggregateListFactory />
1613
}
1714
]
1815
}

0 commit comments

Comments
 (0)