diff --git a/README-zh_CN.md b/README-zh_CN.md index 079daff..ca561d4 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -611,7 +611,7 @@ const usePost = createQuery({ // `data` 将被推断为 `Data | undefined`. // `variables` 将被推断为 `Variables`. -const { data } = usePost({ variables: 1 }) +const { data } = usePost({ variables: { id: 1 } }) ``` 您还可以显式指定 `fetcher` 参数和返回的类型。 @@ -630,7 +630,7 @@ const usePost = createQuery({ // `data` 将被推断为 `Data | undefined`. // `error` 将被推断为 `Error | null` // `variables` 将被推断为 `Variables`. -const { data, error } = usePost({ variables: 1 }) +const { data, error } = usePost({ variables: { id: 1 } }) ``` ## 类型推导 diff --git a/README.md b/README.md index 1e50ea9..7c84e3f 100644 --- a/README.md +++ b/README.md @@ -611,7 +611,7 @@ const usePost = createQuery({ // `data` will be inferred as `Data | undefined`. // `variables` will be inferred as `Variables`. -const { data } = usePost({ variables: 1 }) +const { data } = usePost({ variables: { id: 1 } }) ``` You can also explicitly specify the types for `fetcher`‘s `variables` and `data`. @@ -630,7 +630,7 @@ const usePost = createQuery({ // `data` will be inferred as `Data | undefined`. // `error` will be inferred as `Error | null` // `variables` will be inferred as `Variables`. -const { data, error } = usePost({ variables: 1 }) +const { data, error } = usePost({ variables: { id: 1 } }) ``` ## Type inference