Skip to content

Commit a44483d

Browse files
feat: Migrate packages from Remix to React Router (#251)
Co-authored-by: me <me@kentcdodds.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com>
1 parent 903d30a commit a44483d

80 files changed

Lines changed: 2161 additions & 6214 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

package-lock.json

Lines changed: 1843 additions & 5861 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/workshop-app/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ node_modules
66

77
/prisma/data.db
88
/prisma/data.db-journal
9+
10+
.react-router/

packages/workshop-app/app/components/apps.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { useRouteLoaderData } from '@remix-run/react'
2-
import { type loader as rootLoader } from '#app/root.tsx'
1+
import { useRouteLoaderData } from 'react-router'
2+
import { type RootLoaderData } from '#app/root.tsx'
33

44
export function useApps() {
5-
const data = useRouteLoaderData<typeof rootLoader>('root')
5+
const data = useRouteLoaderData('root') as RootLoaderData
66
if (!data) {
77
throw new Error('useApps requires a data object from the root loader')
88
}

packages/workshop-app/app/components/button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { Link } from '@remix-run/react'
21
import { clsx } from 'clsx'
2+
import { Link } from 'react-router'
33

44
function PendingState() {
55
return <span className="inline-block animate-spin">🌀</span>

packages/workshop-app/app/components/diff.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import * as Accordion from '@radix-ui/react-accordion'
22
import * as Select from '@radix-ui/react-select'
3+
import { clsx } from 'clsx'
4+
import React, { Suspense } from 'react'
35
import {
46
Await,
57
Form,
68
Link,
79
useNavigation,
810
useSearchParams,
911
useSubmit,
10-
} from '@remix-run/react'
11-
import { clsx } from 'clsx'
12-
import React, { Suspense } from 'react'
12+
} from 'react-router'
1313
import { useSpinDelay } from 'spin-delay'
1414
import AccordionComponent from '#app/components/accordion.tsx'
1515
import { Mdx } from '#app/utils/mdx.tsx'
@@ -109,7 +109,7 @@ export function Diff({
109109
<Await
110110
resolve={diff}
111111
errorElement={
112-
<p className="text-foreground-destructive p-6">
112+
<p className="p-6 text-foreground-destructive">
113113
There was an error calculating the diff. Sorry.
114114
</p>
115115
}

packages/workshop-app/app/components/epic-video.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { type EpicVideoInfos } from '@epic-web/workshop-utils/epic-api.server'
22
import { type MuxPlayerRefAttributes } from '@mux/mux-player-react'
3-
import { Await, Link } from '@remix-run/react'
43
import * as React from 'react'
4+
import { Await, Link } from 'react-router'
55
import { useTheme } from '#app/routes/theme/index.tsx'
66
import { MuxPlayer } from '#app/routes/video-player/index.tsx'
77
import { cn } from '#app/utils/misc.tsx'

packages/workshop-app/app/components/error-boundary.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
useParams,
44
useRouteError,
55
type ErrorResponse,
6-
} from '@remix-run/react'
6+
} from 'react-router'
77
import { getErrorMessage } from '#app/utils/misc.tsx'
88

99
type StatusHandler = (info: {

packages/workshop-app/app/components/in-browser-browser.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { Form, useSearchParams, type NavigateFunction } from '@remix-run/react'
21
import { clsx } from 'clsx'
32
import {
43
forwardRef,
@@ -8,6 +7,7 @@ import {
87
useState,
98
type ForwardedRef,
109
} from 'react'
10+
import { Form, useSearchParams, type NavigateFunction } from 'react-router'
1111
import { z } from 'zod'
1212
import { Icon } from '#app/components/icons.tsx'
1313
import { AppStarter, AppStopper, PortStopper } from '#app/routes/start.tsx'
@@ -324,7 +324,7 @@ function InBrowserBrowserForRealzImpl(
324324
setPathnameInputValue(newPathnameInputValue)
325325

326326
const currentPathname = iframeContext.history[iframeContext.index]
327-
navigateChild(newPathnameInputValue, {
327+
void navigateChild(newPathnameInputValue, {
328328
replace: currentPathname === newPathnameInputValue,
329329
})
330330
}

packages/workshop-app/app/components/nav-chevrons.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Link, type LinkProps } from '@remix-run/react'
1+
import { Link, type LinkProps } from 'react-router'
22
import { Icon } from './icons.tsx'
33

44
export function NavChevrons({

packages/workshop-app/app/components/progress-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { useFetchers, useNavigation } from '@remix-run/react'
21
import { useEffect, useRef, useState } from 'react'
2+
import { useFetchers, useNavigation } from 'react-router'
33
import { useSpinDelay } from 'spin-delay'
44
import { cn } from '#app/utils/misc.tsx'
55

0 commit comments

Comments
 (0)