Skip to content

Commit 730bed0

Browse files
authored
Merge pull request #14 from atomic-router/feat/use-component-type-for-view
use `ComponentType` for view instead of `FC`
2 parents 525b3fa + cac4afc commit 730bed0

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/create-route-view.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { useIsOpened } from "./use-is-opened";
55

66
export type RouteViewConfig<Props, Params> = {
77
route: RouteInstance<Params> | RouteInstance<Params>[];
8-
view: React.FC<Props>;
9-
otherwise?: React.FC<Props>;
8+
view: React.ComponentType<Props>;
9+
otherwise?: React.ComponentType<Props>;
1010
};
1111

1212
export const createRouteView = <

src/create-routes-view.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import React, { FC } from "react";
1+
import React from "react";
22
import { RouteInstance } from "atomic-router";
33

44
import { useIsOpened } from "./use-is-opened";
55

66
type RouteRecord<Props, Params> = {
77
route: RouteInstance<Params> | RouteInstance<Params>[];
8-
view: FC<Props>;
8+
view: React.ComponentType<Props>;
99
};
1010

1111
export type RoutesViewConfig = {
1212
routes: RouteRecord<any, any>[];
13-
otherwise?: React.FC<any>;
13+
otherwise?: React.ComponentType<any>;
1414
};
1515

1616
export const createRoutesView = <Config extends RoutesViewConfig>(config: Config) => {

src/route.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React, { FC } from 'react';
2-
import { RouteInstance, RouteParams } from 'atomic-router';
1+
import React from "react";
2+
import { RouteInstance, RouteParams } from "atomic-router";
33

4-
import { useIsOpened } from './use-is-opened';
4+
import { useIsOpened } from "./use-is-opened";
55

66
type Props<Params extends RouteParams> = {
77
route: RouteInstance<Params> | RouteInstance<Params>[];
8-
view: FC;
8+
view: React.ComponentType;
99
};
1010

1111
export function Route<Params>({ route, view: Component }: Props<Params>) {

0 commit comments

Comments
 (0)