examples/react/eslint-legacy
| Name | Last commit message | Last commit date |
|---|---|---|
| .. | ||
README.md
TanStack React Query Basic Example (ESLint Legacy Config)#
The basic posts example, linted with the legacy .eslintrc config of @tanstack/eslint-plugin-query.
How it works#
src/index.tsxdeclares the queries inline:PostscallsuseQuerywithqueryKey: ['posts'], andPostcalls it withqueryKey: ['post', postId]andenabled: !!postId.- In
src/index.tsx, the list marks a post as visited whenqueryClient.getQueryData(['post', post.id])returns cached data. src/index.tsxwraps the app inPersistQueryClientProviderwith acreateAsyncStoragePersisteroverwindow.localStorage, and itsQueryClientsetsgcTimeto 24 hours..eslintrcextendsplugin:@tanstack/query/recommended, and thetest:eslintscript inpackage.jsonruns ESLint withESLINT_USE_FLAT_CONFIG=falseso the legacy config is used.
To run this example:
npm installnpm run dev