Skip to content
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

docs(solid-query): Fix API signature in overview.md #5470

Merged
merged 1 commit into from
May 27, 2023
Merged
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
17 changes: 9 additions & 8 deletions docs/solid/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,21 @@ export default function App() {
function Example() {
// ❌ react version -- supports destructing outside reactive context
// const { isPending, error, data } = useQuery({
// queryKey: ['repoData'], () =>
// queryFn: fetch('https://api.github.com/repos/tannerlinsley/react-query').then(res =>
// res.json()
// )
// queryKey: ['repoData'],
// queryFn: () =>
// fetch('https://api.github.com/repos/tannerlinsley/react-query').then(
// (res) => res.json()
// ),
// })

// ✅ solid version -- does not support destructuring outside reactive context
const query = createQuery({
queryKey: () => ['repoData'],
const query = createQuery(() => ({
queryKey: ['repoData'],
queryFn: () =>
fetch('https://api.github.com/repos/tannerlinsley/react-query').then(
(res) => res.json(),
(res) => res.json()
),
})
}))

// ✅ access query properties in JSX reactive context
return (
Expand Down