Skip to content

Commit 0c66727

Browse files
authored
feat(react): add "support" for react18 (#3520)
1 parent 1ab13dc commit 0c66727

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
"match-sorter": "^6.0.2"
7171
},
7272
"peerDependencies": {
73-
"react": "^16.8.0 || ^17.0.0"
73+
"react": "^16.8.0 || ^17.0.0 || ^18.0.0"
7474
},
7575
"peerDependenciesMeta": {
7676
"react-dom": {

src/react/Hydrate.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,10 @@ export function useHydrate(state: unknown, options?: HydrateOptions) {
2323
export interface HydrateProps {
2424
state?: unknown
2525
options?: HydrateOptions
26+
children?: React.ReactNode
2627
}
2728

28-
export const Hydrate: React.FC<HydrateProps> = ({
29-
children,
30-
options,
31-
state,
32-
}) => {
29+
export const Hydrate = ({ children, options, state }: HydrateProps) => {
3330
useHydrate(state, options)
34-
return children as React.ReactElement<any>
31+
return children as React.ReactElement
3532
}

src/react/QueryClientProvider.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ export const useQueryClient = () => {
4444
export interface QueryClientProviderProps {
4545
client: QueryClient
4646
contextSharing?: boolean
47+
children?: React.ReactNode
4748
}
4849

49-
export const QueryClientProvider: React.FC<QueryClientProviderProps> = ({
50+
export const QueryClientProvider = ({
5051
client,
5152
contextSharing = false,
5253
children,
53-
}) => {
54+
}: QueryClientProviderProps): JSX.Element => {
5455
React.useEffect(() => {
5556
client.mount()
5657
return () => {

src/react/QueryErrorResetBoundary.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ export interface QueryErrorResetBoundaryProps {
3838
| React.ReactNode
3939
}
4040

41-
export const QueryErrorResetBoundary: React.FC<QueryErrorResetBoundaryProps> = ({
41+
export const QueryErrorResetBoundary = ({
4242
children,
43-
}) => {
43+
}: QueryErrorResetBoundaryProps) => {
4444
const value = React.useMemo(() => createValue(), [])
4545
return (
4646
<QueryErrorResetBoundaryContext.Provider value={value}>

src/react/tests/utils.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,12 @@ export const expectType = <T,>(_: T): void => undefined
6767
export const expectTypeNotAny = <T,>(_: 0 extends 1 & T ? never : T): void =>
6868
undefined
6969

70-
export const Blink: React.FC<{ duration: number }> = ({
70+
export const Blink = ({
7171
duration,
7272
children,
73+
}: {
74+
duration: number
75+
children: React.ReactNode
7376
}) => {
7477
const [shouldShow, setShouldShow] = React.useState<boolean>(true)
7578

0 commit comments

Comments
 (0)