Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

index.js

424 lines18.4 KB

1import * as React from 'react'
2import { ParentSize } from '@visx/responsive'
3import Head from 'next/head'
4import Link from 'next/link'
5​
6//
7import { siteConfig } from '../siteConfig'
8​
9import { Banner } from '../components/Banner'
10import { Sticky } from '../components/Sticky'
11import { Nav } from '../components/Nav'
12import { Footer } from '../components/Footer'
13import { ClientsMarquee } from '../components/clients/ClientsMarquee'
14import { Seo } from '../components/Seo'
15​
16const Home = ({ sponsors }) => {
17 return (
18 <>
19 <Seo
20 title="React Query"
21 description="Hooks for fetching, caching and updating asynchronous data in React"
22 />
23 <Head>
24 <title>
25 React Query - Hooks for fetching, caching and updating asynchronous
26 data in React
27 </title>
28 </Head>
29 <div className="bg-gray-50 h-full min-h-full">
30 <Banner />
31 <Sticky>
32 <Nav />
33 </Sticky>
34 <div className="relative bg-white overflow-hidden">
35 <div className="py-24 mx-auto container px-4 sm:mt-12 relative">
36 <img
37 src={require('images/emblem-light.svg')}
38 className="absolute transform right-0 top-1/2 h-0 lg:h-full scale-150 translate-x-1/2 xl:translate-x-1/5 -translate-y-1/2"
39 alt="React Query Emblem"
40 />
41 <div className="grid grid-cols-12 lg:gap-8">
42 <div className="col-span-12 lg:col-span-6 ">
43 <div className="text-center lg:text-left md:max-w-2xl md:mx-auto ">
44 <h1 className="text-4xl tracking-tight leading-10 font-extrabold text-gray-900 sm:leading-none sm:text-6xl lg:text-5xl xl:text-6xl">
45 Performant and powerful data
46 <br className="hidden md:inline xl:hidden" />{' '}
47 <span>synchronization for React</span>
48 </h1>
49 <p className="mt-3 text-base text-gray-700 sm:mt-5 sm:text-xl lg:text-lg xl:text-xl">
50 Fetch, cache and update data in your React and React Native
51 applications all without touching any "global state".
52 </p>
53​
54 <div className="mt-5 mx-auto sm:flex sm:justify-center lg:justify-start lg:mx-0 md:mt-8">
55 <div className="rounded-md shadow">
56 <Link href="/overview">
57 <a className="w-full flex items-center justify-center px-8 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:border-coral focus:shadow-outline-coral transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10">
58 Get Started
59 </a>
60 </Link>
61 </div>
62 <div className="mt-3 rounded-md shadow sm:mt-0 sm:ml-3">
63 <a
64 href={siteConfig.repoUrl}
65 target="_blank"
66 rel="noopener noreferrer"
67 className="w-full flex items-center justify-center px-8 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-coral bg-white hover:text-coral-light focus:outline-none focus:border-coral-light focus:shadow-outline-coral transition duration-150 ease-in-out md:py-4 md:text-lg md:px-10"
68 >
69 GitHub
70 </a>
71 </div>
72 </div>
73 <div className="mt-5">
74 <p>
75 Want to skip the docs?{' '}
76 <a
77 href="https://ui.dev/checkout/react-query?from=tanstack"
78 className="text-blue-600 font-semibold transition-colors duration-150 ease-out"
79 >
80 Take the offical course
81 </a>
82 </p>
83 </div>
84 </div>
85 </div>
86 </div>
87 </div>
88 </div>
89 <div className="text-lg border-t border-gray-200 bg-gray-50 ">
90 <div className="py-24 ">
91 <div className="mx-auto container">
92 <div className="lg:grid lg:grid-cols-3 lg:gap-8">
93 <div>
94 <div>
95 <h3 className="text-xl leading-6 xl:text-2xl font-bold text-gray-900">
96 Declarative & Automatic
97 </h3>
98 <p className="mt-2 lg:mt-4 text-base xl:text-lg lg:leading-normal leading-6 text-gray-600">
99 Writing your data fetching logic by hand is over. Tell
100 React Query where to get your data and how fresh you need
101 it to be and the rest is automatic. React Query handles
102 caching, background updates and stale data out of the box
103 with zero-configuration.
104 </p>
105 </div>
106 </div>
107 <div className="mt-10 lg:mt-0">
108 <div>
109 <h3 className="text-xl leading-6 xl:text-2xl font-bold text-gray-900">
110 Simple & Familiar
111 </h3>
112 <p className="mt-2 lg:mt-4 text-base xl:text-lg lg:leading-normal leading-6 text-gray-600">
113 If you know how to work with promises or async/await, then
114 you already know how to use React Query. There's no global
115 state to manage, reducers, normalization systems or heavy
116 configurations to understand. Simply pass a function that
117 resolves your data (or throws an error) and the rest is
118 history.
119 </p>
120 </div>
121 </div>
122 <div className="mt-10 lg:mt-0">
123 <div>
124 <h3 className="text-xl leading-6 xl:text-2xl font-bold text-gray-900">
125 Powerful & Configurable
126 </h3>
127 <p className="mt-2 lg:mt-4 text-base xl:text-lg lg:leading-normal leading-6 text-gray-600">
128 React Query is configurable down to each observer instance
129 of a query with knobs and options to fit every use-case.
130 It comes wired up with dedicated devtools,
131 infinite-loading APIs, and first class mutation tools that
132 make updating your data a breeze. Don't worry though,
133 everything is pre-configured for success!
134 </p>
135 </div>
136 </div>
137 </div>
138 </div>
139 </div>
140 <div className="bg-gray-900 text-white">
141 <div className="py-32">
142 <div className="mx-auto container text-center">
143 <div className="text-xl">THE OFFICIAL</div>
144 <div className="text-3xl md:text-5xl font-bold">
145 React Query Course
146 </div>
147 <div className="text-xl italic">
148 Created by <strong>Tanner Linsley</strong> and{' '}
149 <strong>ui.dev</strong>
150 </div>
151​
152 <p className="mt-4 text-xl max-w-3xl mx-auto leading-7 text-gray-300">
153 "This is the fastest way to learn how to build
154 enterprise-level applications with React Query and support my
155 open source work. Win. Win."
156 <br />
157 -Tanner Linsley
158 </p>
159 <div className="grid pt-8 text-white max-w-screen-lg mx-auto text-lg">
160 <span className="mb-2">
161 <span className="bg-coral text-gray-800 w-4 h-4 mr-2 rounded-full inline-flex items-center justify-center">
162 <Check />
163 </span>
164 Save time by learning with a guided approach
165 </span>
166 <span className="mb-2">
167 <span className="bg-coral text-gray-800 w-4 h-4 mr-2 rounded-full inline-flex items-center justify-center">
168 <Check />
169 </span>
170 Get hands-on experience building a real world application
171 </span>
172 <span className="mb-2">
173 <span className="bg-coral text-gray-800 w-4 h-4 mr-2 rounded-full inline-flex items-center justify-center">
174 <Check />
175 </span>
176 Never worry about data fetching again
177 </span>
178 </div>
179 <a
180 href="https://ui.dev/checkout/react-query?from=tanstack"
181 target="_blank"
182 className="inline-block mt-8 rounded shadow-lg bg-coral text-white font-bold text-xl px-4 py-3"
183 >
184 ENROLL NOW
185 </a>
186 </div>
187 </div>
188 </div>
189 <div className="py-6">
190 <div className="uppercase tracking-wider text-sm font-semibold text-center text-gray-400 mb-3">
191 Trusted in Production by
192 </div>
193​
194 <ClientsMarquee />
195 </div>
196 </div>
197​
198 <div className="relative text-lg border-t border-gray-200 bg-gray-100 overflow-hidden">
199 <div className="lg:block lg:absolute lg:inset-0">
200 <svg
201 className="absolute top-1/2 left-1/2 transform -translate-y-1/2 -translate-x-1/2"
202 width="2400"
203 height="2400"
204 fill="none"
205 viewBox="0 0 2400 2400"
206 >
207 <defs>
208 <pattern
209 id="9ebea6f4-a1f5-4d96-8c4e-4c2abf658047"
210 x="0"
211 y="0"
212 width="20"
213 height="20"
214 patternUnits="userSpaceOnUse"
215 >
216 <rect
217 x="0"
218 y="0"
219 width="4"
220 height="4"
221 className="text-gray-200"
222 fill="currentColor"
223 />
224 </pattern>
225 </defs>
226 <rect
227 x="0"
228 width="2400"
229 height="2400"
230 fill="url(#9ebea6f4-a1f5-4d96-8c4e-4c2abf658047)"
231 />
232 </svg>
233 </div>
234 <div className="relative">
235 <h3 className="text-center text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10 lg:leading-none mt-8">
236 Sponsors
237 </h3>
238 <div
239 className="py-4 flex flex-wrap mx-auto"
240 style={{ maxWidth: '95%' }}
241 >
242 <ParentSize>
243 {({ width }) => {
244 return (
245 <iframe
246 title="sponsors"
247 src="https://tanstack.com/sponsors-embed"
248 style={{
249 width: width,
250 height: width,
251 overflow: 'hidden',
252 }}
253 />
254 )
255 }}
256 </ParentSize>
257 </div>
258 <div className="text-center mb-8">
259 <a
260 href="https://github.com/sponsors/tannerlinsley"
261 className="inline-block bg-green-500 px-4 py-2 text-xl mx-auto leading-tight font-extrabold tracking-tight text-white rounded-full"
262 >
263 Become a Sponsor!
264 </a>
265 </div>
266 </div>
267 </div>
268​
269 <div className="bg-gray-100 relative py-24 border-t border-gray-200 ">
270 <div className="px-4 sm:px-6 lg:px-8 mx-auto container max-w-3xl sm:text-center">
271 <h3 className="text-3xl leading-8 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10 lg:leading-none mt-2">
272 Less Code. Fewer Edge Cases.
273 </h3>
274 <p className="my-4 text-xl leading-7 text-gray-600">
275 Instead of writing reducers, caching logic, timers, retry logic,
276 complex async/await scripting (I could keep going...), you
277 literally write a tiny fraction of the code you normally would.
278 You will be surprised at how little code you're writing or how
279 much code you're deleting when you use React Query.
280 </p>
281 </div>
282 <div
283 style={{
284 height: 224,
285 }}
286 />
287 </div>
288​
289 <section className="bg-gray-900 body-font">
290 <div className="container max-w-7xl px-4 mx-auto -mt-72 relative">
291 <iframe
292 src="https://codesandbox.io/embed/github/tannerlinsley/react-query/tree/master/examples/basic?autoresize=1&fontsize=16&theme=dark"
293 title="tannerlinsley/react-query: basic"
294 sandbox="allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts"
295 className="shadow-2xl"
296 style={{
297 width: '100%',
298 height: '80vh',
299 border: '0',
300 borderRadius: 8,
301 overflow: 'hidden',
302 position: 'static',
303 zIndex: 0,
304 }}
305 ></iframe>
306 </div>
307 <div className="py-24 px-4 sm:px-6 lg:px-8 mx-auto container">
308 <div className=" sm:text-center pb-16">
309 <h3 className="text-3xl mx-auto leading-tight font-extrabold tracking-tight text-white sm:text-4xl lg:leading-none mt-2">
310 One Dep, All the Features.
311 </h3>
312 <p className="mt-4 text-xl max-w-3xl mx-auto leading-7 text-gray-300">
313 With React as the only dependency, React Query is extremely
314 lean, but also strategically packed to the brim with features
315 you're bound to need in almost any project. From weekend hobbies
316 all the way up to enterprise e-commerce systems (lookin' at you
317 Walmart!), React Query is jam packed with battle-hardened tools
318 to help you succeed.
319 </p>
320 </div>
321 <div>
322 <div className="grid grid-flow-row grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-4 text-white max-w-screen-lg mx-auto text-lg">
323 {[
324 'Backend agnostic',
325 'Dedicated Devtools',
326 'Auto Caching',
327 'Auto Refetching',
328 'Window Focus Refetching',
329 'Polling/Realtime Queries',
330 'Parallel Queries',
331 'Dependent Queries',
332 'Mutations API',
333 'Automatic Garbage Collection',
334 'Paginated/Cursor Queries',
335 'Load-More/Infinite Scroll Queries',
336 'Scroll Recovery',
337 'Request Cancellation',
338 'Suspense Ready!',
339 'Render-as-you-fetch',
340 'Prefetching',
341 'Variable-length Parallel Queries',
342 'Offline Support',
343 'SSR Support',
344 'Data Selectors',
345 ].map(feature => (
346 <span className="mb-2" key={feature}>
347 <span className="bg-coral text-gray-800 w-4 h-4 mr-2 rounded-full inline-flex items-center justify-center">
348 <Check />
349 </span>
350 {feature}
351 </span>
352 ))}
353 </div>
354 </div>
355 </div>
356 </section>
357 <div className="bg-gray-200 border-b border-gray-300">
358 <div className="container mx-auto py-12 text-center">
359 <h3 className="text-2xl md:text-5xl mx-auto leading-tight font-extrabold tracking-tight text-gray-800 lg:leading-none mt-2">
360 Feeling Chatty?
361 </h3>
362 <a
363 href="https://discord.gg/WrRKjPJ"
364 target="_blank"
365 className="inline-block bg-gray-800 p-5 text-2xl mx-auto leading-tight font-extrabold tracking-tight text-white mt-12 rounded-full"
366 >
367 Join the #TanStack Discord!
368 </a>
369 </div>
370 </div>
371 <div className="bg-gray-50 border-b border-gray-100">
372 <div className="container mx-auto py-24 px-4 flex flex-wrap md:flex-no-wrap items-center justify-between md:space-x-8">
373 <h2 className="text-3xl leading-9 font-extrabold tracking-tight text-gray-900 sm:text-4xl sm:leading-10">
374 Wow, you've come a long way!
375 </h2>
376 <div className="mt-8 flex lg:flex-shrink-0 md:mt-0">
377 <div className="inline-flex rounded-md shadow">
378 <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">
379 Take the course
380 </a>
381 </div>
382 <div className="ml-3 inline-flex rounded-md shadow">
383 <Link href="/overview">
384 <a 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-coral bg-white hover:text-coral-light focus:outline-none focus:shadow-outline transition duration-150 ease-in-out">
385 Read the docs
386 </a>
387 </Link>
388 </div>
389 </div>
390 </div>
391 </div>
392 <Footer />
393 <style jsx global>{`
394 .gradient {
395 -webkit-mask-image: linear-gradient(
396 180deg,
397 transparent 0,
398 #000 30px,
399 #000 calc(100% - 200px),
400 transparent calc(100% - 100px)
401 );
402 }
403 `}</style>
404 </div>
405 </>
406 )
408​
409export default Home
410Home.displayName = 'Home'
411const Check = React.memo(() => (
412 <svg
413 fill="none"
414 stroke="currentColor"
415 strokeLinecap="round"
416 strokeLinejoin="round"
417 strokeWidth="3"
418 className="w-3 h-3"
419 viewBox="0 0 24 24"
420 aria-hidden="true"
421 >
422 <path d="M20 6L9 17l-5-5"></path>
423 </svg>
424))