Skip to content

Commit 2b8a1f4

Browse files
committed
ref: set react-jsx to omit React import
rel #38
1 parent 44eeb64 commit 2b8a1f4

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/create-route-view.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { RouteInstance, RouteParams } from "atomic-router";
2-
import React, { type ComponentType } from "react";
2+
import { type ComponentType } from "react";
33

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

src/create-routes-view.tsx

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

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

66
export interface RouteRecord<Props, Params extends RouteParams> {
77
route: RouteInstance<Params> | RouteInstance<Params>[];
8-
view: React.ComponentType<Props>;
8+
view: ComponentType<Props>;
99
layout?: FC<{ children: ReactNode }>;
1010
}
1111

1212
export interface RoutesViewConfig {
1313
routes: RouteRecord<any, any>[];
14-
otherwise?: React.ComponentType<any>;
14+
otherwise?: ComponentType<any>;
1515
}
1616

1717
export function createRoutesView<Config extends RoutesViewConfig>(config: Config) {

src/link.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type RouteInstance, type RouteParams, type RouteQuery, buildPath } from "atomic-router";
22
import clsx from "clsx";
33
import { useUnit } from "effector-react";
4-
import React, { type AnchorHTMLAttributes, type ForwardedRef, forwardRef } from "react";
4+
import { type AnchorHTMLAttributes, type ForwardedRef, forwardRef } from "react";
55

66
import { useRouter } from "./router-provider";
77

src/route.tsx

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

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

66
export interface RouteProps<Params extends RouteParams> {
77
route: RouteInstance<Params> | RouteInstance<Params>[];
8-
view: React.ComponentType;
8+
view: ComponentType;
99
}
1010

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

src/router-provider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { HistoryRouter } from "atomic-router";
2-
import React, { type ReactNode, createContext, useContext } from "react";
2+
import { type ReactNode, createContext, useContext } from "react";
33

44
export const RouterContext = createContext<HistoryRouter | null>(null);
55

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// use Node's module resolution algorithm, instead of the legacy TS one
2323
"moduleResolution": "node",
2424
// transpile JSX to React.createElement
25-
"jsx": "react",
25+
"jsx": "react-jsx",
2626
// interop between ESM and CJS modules. Recommended by TS
2727
"esModuleInterop": true,
2828
// significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS

0 commit comments

Comments
 (0)