Skip to content

Commit c3131b4

Browse files
committed
Restore uppercase Component object key in React's App.ts (#2654)
1 parent 1868e43 commit c3131b4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/react/src/App.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type CurrentPage = {
2828
}
2929

3030
export interface InertiaAppProps<SharedProps extends PageProps = PageProps> {
31-
children?: (options: { component: ReactComponent; props: PageProps; key: number | null }) => ReactNode
31+
children?: (options: { Component: ReactComponent; props: PageProps; key: number | null }) => ReactNode
3232
initialPage: Page<SharedProps>
3333
initialComponent?: ReactComponent
3434
resolveComponent?: (name: string) => ReactComponent | Promise<ReactComponent>
@@ -99,15 +99,15 @@ export default function App<SharedProps extends PageProps = PageProps>({
9999

100100
const renderChildren =
101101
children ||
102-
(({ component, props, key }) => {
103-
const child = createElement(component, { key, ...props })
102+
(({ Component, props, key }) => {
103+
const child = createElement(Component, { key, ...props })
104104

105-
if (typeof component.layout === 'function') {
106-
return (component.layout as LayoutFunction)(child)
105+
if (typeof Component.layout === 'function') {
106+
return (Component.layout as LayoutFunction)(child)
107107
}
108108

109-
if (Array.isArray(component.layout)) {
110-
return (component.layout as any)
109+
if (Array.isArray(Component.layout)) {
110+
return (Component.layout as any)
111111
.concat(child)
112112
.reverse()
113113
.reduce((children: any, Layout: any) => createElement(Layout, { children, ...props }))
@@ -123,7 +123,7 @@ export default function App<SharedProps extends PageProps = PageProps>({
123123
PageContext.Provider,
124124
{ value: current.page },
125125
renderChildren({
126-
component: current.component,
126+
Component: current.component,
127127
key: current.key,
128128
props: current.page.props,
129129
}),

0 commit comments

Comments
 (0)