Skip to content

Commit

Permalink
docs(solid-query): Fix API signature in overview.md (#5470)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuji Sugiura committed May 27, 2023
1 parent 91f4a6b commit 210e4c7
Showing 1 changed file with 9 additions and 8 deletions.
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

0 comments on commit 210e4c7

Please sign in to comment.