{"id":29031760,"url":"https://github.com/pdevito3/hello-autocomplete","last_synced_at":"2025-06-26T10:05:24.585Z","repository":{"id":293384115,"uuid":"977359064","full_name":"pdevito3/hello-autocomplete","owner":"pdevito3","description":"sandboxing autocomplete work","archived":false,"fork":false,"pushed_at":"2025-05-21T03:36:49.000Z","size":457,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T01:23:36.839Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pdevito3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-04T02:44:20.000Z","updated_at":"2025-05-21T03:36:52.000Z","dependencies_parsed_at":"2025-05-15T04:37:37.889Z","dependency_job_id":null,"html_url":"https://github.com/pdevito3/hello-autocomplete","commit_stats":null,"previous_names":["pdevito3/hello-autocomplete"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pdevito3/hello-autocomplete","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevito3%2Fhello-autocomplete","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevito3%2Fhello-autocomplete/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevito3%2Fhello-autocomplete/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevito3%2Fhello-autocomplete/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pdevito3","download_url":"https://codeload.github.com/pdevito3/hello-autocomplete/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pdevito3%2Fhello-autocomplete/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262044451,"owners_count":23249752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-26T10:05:23.868Z","updated_at":"2025-06-26T10:05:24.569Z","avatar_url":"https://github.com/pdevito3.png","language":"TypeScript","readme":"Welcome to your new TanStack app! \n\n# Getting Started\n\nTo run this application:\n\n```bash\npnpm install\npnpm start  \n```\n\n# Building For Production\n\nTo build this application for production:\n\n```bash\npnpm build\n```\n\n## Testing\n\nThis project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:\n\n```bash\npnpm test\n```\n\n## Styling\n\nThis project uses [Tailwind CSS](https://tailwindcss.com/) for styling.\n\n\n\n\n## Routing\nThis project uses [TanStack Router](https://tanstack.com/router). The initial setup is a file based router. Which means that the routes are managed as files in `src/routes`.\n\n### Adding A Route\n\nTo add a new route to your application just add another a new file in the `./src/routes` directory.\n\nTanStack will automatically generate the content of the route file for you.\n\nNow that you have two routes you can use a `Link` component to navigate between them.\n\n### Adding Links\n\nTo use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/react-router`.\n\n```tsx\nimport { Link } from \"@tanstack/react-router\";\n```\n\nThen anywhere in your JSX you can use it like so:\n\n```tsx\n\u003cLink to=\"/about\"\u003eAbout\u003c/Link\u003e\n```\n\nThis will create a link that will navigate to the `/about` route.\n\nMore information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).\n\n### Using A Layout\n\nIn the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you use the `\u003cOutlet /\u003e` component.\n\nHere is an example layout that includes a header:\n\n```tsx\nimport { Outlet, createRootRoute } from '@tanstack/react-router'\nimport { TanStackRouterDevtools } from '@tanstack/react-router-devtools'\n\nimport { Link } from \"@tanstack/react-router\";\n\nexport const Route = createRootRoute({\n  component: () =\u003e (\n    \u003c\u003e\n      \u003cheader\u003e\n        \u003cnav\u003e\n          \u003cLink to=\"/\"\u003eHome\u003c/Link\u003e\n          \u003cLink to=\"/about\"\u003eAbout\u003c/Link\u003e\n        \u003c/nav\u003e\n      \u003c/header\u003e\n      \u003cOutlet /\u003e\n      \u003cTanStackRouterDevtools /\u003e\n    \u003c/\u003e\n  ),\n})\n```\n\nThe `\u003cTanStackRouterDevtools /\u003e` component is not required so you can remove it if you don't want it in your layout.\n\nMore information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#layouts).\n\n\n## Data Fetching\n\nThere are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.\n\nFor example:\n\n```tsx\nconst peopleRoute = createRoute({\n  getParentRoute: () =\u003e rootRoute,\n  path: \"/people\",\n  loader: async () =\u003e {\n    const response = await fetch(\"https://swapi.dev/api/people\");\n    return response.json() as Promise\u003c{\n      results: {\n        name: string;\n      }[];\n    }\u003e;\n  },\n  component: () =\u003e {\n    const data = peopleRoute.useLoaderData();\n    return (\n      \u003cul\u003e\n        {data.results.map((person) =\u003e (\n          \u003cli key={person.name}\u003e{person.name}\u003c/li\u003e\n        ))}\n      \u003c/ul\u003e\n    );\n  },\n});\n```\n\nLoaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#loader-parameters).\n\n### React-Query\n\nReact-Query is an excellent addition or alternative to route loading and integrating it into you application is a breeze.\n\nFirst add your dependencies:\n\n```bash\npnpm add @tanstack/react-query @tanstack/react-query-devtools\n```\n\nNext we'll need to create a query client and provider. We recommend putting those in `main.tsx`.\n\n```tsx\nimport { QueryClient, QueryClientProvider } from \"@tanstack/react-query\";\n\n// ...\n\nconst queryClient = new QueryClient();\n\n// ...\n\nif (!rootElement.innerHTML) {\n  const root = ReactDOM.createRoot(rootElement);\n\n  root.render(\n    \u003cQueryClientProvider client={queryClient}\u003e\n      \u003cRouterProvider router={router} /\u003e\n    \u003c/QueryClientProvider\u003e\n  );\n}\n```\n\nYou can also add TanStack Query Devtools to the root route (optional).\n\n```tsx\nimport { ReactQueryDevtools } from \"@tanstack/react-query-devtools\";\n\nconst rootRoute = createRootRoute({\n  component: () =\u003e (\n    \u003c\u003e\n      \u003cOutlet /\u003e\n      \u003cReactQueryDevtools buttonPosition=\"top-right\" /\u003e\n      \u003cTanStackRouterDevtools /\u003e\n    \u003c/\u003e\n  ),\n});\n```\n\nNow you can use `useQuery` to fetch your data.\n\n```tsx\nimport { useQuery } from \"@tanstack/react-query\";\n\nimport \"./App.css\";\n\nfunction App() {\n  const { data } = useQuery({\n    queryKey: [\"people\"],\n    queryFn: () =\u003e\n      fetch(\"https://swapi.dev/api/people\")\n        .then((res) =\u003e res.json())\n        .then((data) =\u003e data.results as { name: string }[]),\n    initialData: [],\n  });\n\n  return (\n    \u003cdiv\u003e\n      \u003cul\u003e\n        {data.map((person) =\u003e (\n          \u003cli key={person.name}\u003e{person.name}\u003c/li\u003e\n        ))}\n      \u003c/ul\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\nYou can find out everything you need to know on how to use React-Query in the [React-Query documentation](https://tanstack.com/query/latest/docs/framework/react/overview).\n\n## State Management\n\nAnother common requirement for React applications is state management. There are many options for state management in React. TanStack Store provides a great starting point for your project.\n\nFirst you need to add TanStack Store as a dependency:\n\n```bash\npnpm add @tanstack/store\n```\n\nNow let's create a simple counter in the `src/App.tsx` file as a demonstration.\n\n```tsx\nimport { useStore } from \"@tanstack/react-store\";\nimport { Store } from \"@tanstack/store\";\nimport \"./App.css\";\n\nconst countStore = new Store(0);\n\nfunction App() {\n  const count = useStore(countStore);\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e countStore.setState((n) =\u003e n + 1)}\u003e\n        Increment - {count}\n      \u003c/button\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\nOne of the many nice features of TanStack Store is the ability to derive state from other state. That derived state will update when the base state updates.\n\nLet's check this out by doubling the count using derived state.\n\n```tsx\nimport { useStore } from \"@tanstack/react-store\";\nimport { Store, Derived } from \"@tanstack/store\";\nimport \"./App.css\";\n\nconst countStore = new Store(0);\n\nconst doubledStore = new Derived({\n  fn: () =\u003e countStore.state * 2,\n  deps: [countStore],\n});\ndoubledStore.mount();\n\nfunction App() {\n  const count = useStore(countStore);\n  const doubledCount = useStore(doubledStore);\n\n  return (\n    \u003cdiv\u003e\n      \u003cbutton onClick={() =\u003e countStore.setState((n) =\u003e n + 1)}\u003e\n        Increment - {count}\n      \u003c/button\u003e\n      \u003cdiv\u003eDoubled - {doubledCount}\u003c/div\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n\nWe use the `Derived` class to create a new store that is derived from another store. The `Derived` class has a `mount` method that will start the derived store updating.\n\nOnce we've created the derived store we can use it in the `App` component just like we would any other store using the `useStore` hook.\n\nYou can find out everything you need to know on how to use TanStack Store in the [TanStack Store documentation](https://tanstack.com/store/latest).\n\n# Demo files\n\nFiles prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.\n\n# Learn More\n\nYou can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdevito3%2Fhello-autocomplete","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpdevito3%2Fhello-autocomplete","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpdevito3%2Fhello-autocomplete/lists"}