Skip to content

fix: React implicit children type #3490

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions docs/src/components/LayoutDocs.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export const LayoutDocs = props => {
<p className='text-sm'>
Fast track your learning and {' '}
<a
href="https://ui.dev/checkout/react-query?from=tanstack"
href="https://ui.dev/react-query?from=tanstack"
className="text-blue-600 font-semibold transition-colors duration-150 ease-out"
>
take the offical course ↗️
Expand All @@ -128,14 +128,19 @@ export const LayoutDocs = props => {
</div>
<div className="mt-12 relative">
<h4 className="font-semibold uppercase text-sm mb-2 mt-2 text-gray-500">
Subscribe to Bytes
Subscribe to{' '}
<a
className="text-blue-600"
href="https://bytes.dev?r=tanstack"
>
Bytes
</a>
</h4>
<p className="mt-4 text-sm leading-6 mb-4">
The best JavaScript newsletter! Delivered every
Monday to over 76,000 devs.
Your weekly dose of JavaScript news. Delivered every
Monday to over 80,000 devs, for free.
</p>
<BytesForm />

</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/Nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const Nav = () => (
</div>
<div>
<a
href="https://learn.tanstack.com/p/react-query-essentials"
href="https://ui.dev/react-query?from=tanstack"
target="_blank"
className="leading-6 font-medium"
>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/components/PPPBanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export function PPPBanner() {
Course with code{' '}
<a
className="underline cursor-pointer"
href={`/checkout/react-query?from=tanstack&coupon_code=${data.coupon}`}
href={`https://ui.dev/react-query?from=tanstack&coupon_code=${data.coupon}`}
>
<strong>{data.coupon}</strong>
</a>
Expand Down
6 changes: 3 additions & 3 deletions docs/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const Home = ({ sponsors }) => {
<p>
Want to skip the docs?{' '}
<a
href="https://ui.dev/checkout/react-query?from=tanstack"
href="https://ui.dev/react-query?from=tanstack"
className="text-blue-600 font-semibold transition-colors duration-150 ease-out"
>
Take the offical course
Expand Down Expand Up @@ -177,7 +177,7 @@ const Home = ({ sponsors }) => {
</span>
</div>
<a
href="https://ui.dev/checkout/react-query?from=tanstack"
href="https://ui.dev/react-query?from=tanstack"
target="_blank"
className="inline-block mt-8 rounded shadow-lg bg-coral text-white font-bold text-xl px-4 py-3"
>
Expand Down Expand Up @@ -375,7 +375,7 @@ const Home = ({ sponsors }) => {
</h2>
<div className="mt-8 flex lg:flex-shrink-0 md:mt-0">
<div className="inline-flex rounded-md shadow">
<a href="https://ui.dev/checkout/react-query?from=tanstack" className="inline-flex items-center justify-center text-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-coral hover:bg-coral-light focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
<a href="https://ui.dev/react-query?from=tanstack" className="inline-flex items-center justify-center text-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-white bg-coral hover:bg-coral-light focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
Take the course
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ function Example() {

## You talked me into it, so what now?

- Consider taking the official [React Query Course](https://ui.dev/checkout/react-query?from=tanstack) (or buying it for your whole team!)
- Consider taking the official [React Query Course](https://ui.dev/react-query?from=tanstack) (or buying it for your whole team!)
- Learn React Query at your own pace with our amazingly thorough [Walkthrough Guide](../installation) and [API Reference](../reference/useQuery)
13 changes: 8 additions & 5 deletions docs/src/pages/react-native.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,19 @@ import React from 'react'
import { useFocusEffect } from '@react-navigation/native'

export function useRefreshOnFocus<T>(refetch: () => Promise<T>) {
const enabledRef = React.useRef(false)
const firstTimeRef = React.useRef(true)

useFocusEffect(
React.useCallback(() => {
if (enabledRef.current) {
refetch()
} else {
enabledRef.current = true
if (firstTimeRef.current) {
firstTimeRef.current = false;
return;
}

refetch()
}, [refetch])
)
}
```

In the above code, `refetch` is skipped the first time because `useFocusEffect` calls our callback on mount in addition to screen focus.
1 change: 1 addition & 0 deletions src/react/Hydrate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export function useHydrate(state: unknown, options?: HydrateOptions) {
export interface HydrateProps {
state?: unknown
options?: HydrateOptions
children?: React.ReactNode
}

export const Hydrate: React.FC<HydrateProps> = ({
Expand Down
1 change: 1 addition & 0 deletions src/react/QueryClientProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const useQueryClient = () => {
export interface QueryClientProviderProps {
client: QueryClient
contextSharing?: boolean
children?: React.ReactNode
}

export const QueryClientProvider: React.FC<QueryClientProviderProps> = ({
Expand Down
10 changes: 6 additions & 4 deletions src/react/tests/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ export const expectType = <T,>(_: T): void => undefined
export const expectTypeNotAny = <T,>(_: 0 extends 1 & T ? never : T): void =>
undefined

export const Blink: React.FC<{ duration: number }> = ({
duration,
children,
}) => {
interface BlinkProps {
duration: number
children?: React.ReactNode
}

export const Blink: React.FC<BlinkProps> = ({ duration, children }) => {
const [shouldShow, setShouldShow] = React.useState<boolean>(true)

React.useEffect(() => {
Expand Down