Skip to content

Commit 6eefaca

Browse files
committed
feat: remove default 404 page
1 parent 36a3058 commit 6eefaca

File tree

5 files changed

+32
-377
lines changed

5 files changed

+32
-377
lines changed

src/router/components/NotFound/Icon.tsx

Lines changed: 0 additions & 292 deletions
This file was deleted.

src/router/components/NotFound/index.tsx

Lines changed: 0 additions & 60 deletions
This file was deleted.

src/router/components/Router/index.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,13 @@ import { RouteContext } from '../../context/RouteContext'
99
import { ProHistory, ProInfo } from '../../core/history'
1010
import { MatchRecord, Route } from '../../core/route'
1111
import useCreation from '../../hooks/useCreation'
12-
import { DEFAULT_PATH_404 } from '../../utils/constants'
13-
import NotFound from '../NotFound'
1412

1513
export type RouterProps = {
1614
basename?: string
1715
history: History
1816
routes: Route[]
1917
}
2018

21-
const defaultRoute = {
22-
path: DEFAULT_PATH_404,
23-
component: NotFound
24-
}
25-
2619
const renderRoutes = (records: MatchRecord[]) => {
2720
const { length } = records
2821

@@ -48,20 +41,18 @@ export const Router = ({ basename = '/', history, routes }: RouterProps) => {
4841
records: []
4942
})
5043

51-
const mergedRoutes = useMemo(() => [...routes, defaultRoute], [routes])
52-
5344
const proHistory = useCreation(
5445
{
5546
factory: () =>
5647
new ProHistory({
5748
basename,
5849
history,
59-
routes: mergedRoutes,
50+
routes: routes,
6051
subscriber: setState
6152
}),
6253
unmount: t => t.destroy()
6354
},
64-
[basename, history, mergedRoutes]
55+
[basename, history, routes]
6556
)
6657

6758
const children = renderRoutes(records)

0 commit comments

Comments
 (0)