{"id":47667,"library":"fetch-yo-mama","title":"fetch-yo-mama","description":"React hooks for Fetch API with automatic request cancellation on unmount. v0.3.0-rc.2, TypeScript, peer dependency react >= 16.8. Provides useGet, usePost, usePut, usePatch, useDelete hooks with alias-based configuration and built-in loading/error state management. Differentiated by automatic abort, configurable base URLs, and simple API.","status":"active","version":"0.3.0-rc.2","language":"javascript","source_language":"en","source_url":"https://github.com/alexandrius/fetch-yo-mama","tags":["javascript","fetch","useFetch","hook","react","typescript"],"install":[{"cmd":"npm install fetch-yo-mama","lang":"bash","label":"npm"},{"cmd":"yarn add fetch-yo-mama","lang":"bash","label":"yarn"},{"cmd":"pnpm add fetch-yo-mama","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency for hooks","package":"react","optional":false}],"imports":[{"note":"ESM-only; do not use require()","wrong":"const { FetchProvider } = require('fetch-yo-mama')","symbol":"FetchProvider","correct":"import { FetchProvider } from 'fetch-yo-mama'"},{"note":"Named export, not default","wrong":"import useGet from 'fetch-yo-mama'","symbol":"useGet","correct":"import { useGet } from 'fetch-yo-mama'"},{"note":"All hooks are top-level exports","wrong":"import { usePost } from 'fetch-yo-mama/usePost'","symbol":"usePost","correct":"import { usePost } from 'fetch-yo-mama'"},{"note":"","wrong":null,"symbol":"useDelete","correct":"import { useDelete } from 'fetch-yo-mama'"},{"note":"","wrong":null,"symbol":"usePatch","correct":"import { usePatch } from 'fetch-yo-mama'"},{"note":"","wrong":null,"symbol":"usePut","correct":"import { usePut } from 'fetch-yo-mama'"}],"quickstart":{"code":"import React from 'react';\nimport { FetchProvider, useGet } from 'fetch-yo-mama';\n\nfunction App() {\n  return (\n    <FetchProvider\n      aliases={{\n        default: {\n          baseUrl: 'https://jsonplaceholder.typicode.com',\n          headers: { 'Content-Type': 'application/json' },\n        },\n      }}\n    >\n      <UserList />\n    </FetchProvider>\n  );\n}\n\nfunction UserList() {\n  const [usersRequest, fetchUsers, abortControllerRef, clearState] = useGet('/users');\n\n  if (usersRequest.loading) return <p>Loading...</p>;\n  if (usersRequest.error) return <p>Error Loading Data</p>;\n\n  return (\n    <>\n      {usersRequest.response?.map((u) => (\n        <p key={u.id}>{u.name}</p>\n      ))}\n    </>\n  );\n}\n\nexport default App;","lang":"typescript","description":"Basic setup with FetchProvider and useGet hook fetching from JSONPlaceholder."},"warnings":[{"fix":"Update component to destructure return value as array of four elements.","message":"Version 0.2.x to 0.3.0-rc.2 changes internal API: useGet now returns [state, fetch, abortRef, clearState] instead of a single object.","severity":"breaking","affected_versions":">=0.3.0-rc.1"},{"fix":"Move options object to second parameter: useGet('/url', { params: {} }).","message":"Hooks no longer accept inline fetch params directly; params must be passed as the second argument to useGet/usePost/etc.","severity":"breaking","affected_versions":">=0.3.0-rc.1"},{"fix":"If you use clearState, plan to manage state manually or await a replacement.","message":"The 'clearState' function is currently optional and may be removed in future versions.","severity":"deprecated","affected_versions":">=0.3.0-rc.1"},{"fix":"Wrap your app with <FetchProvider>.","message":"FetchProvider must be an ancestor of any component using hooks. Missing provider will cause hooks to throw.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use a single FetchProvider at the root level.","message":"Multiple FetchProviders nesting may cause unexpected behavior; only the innermost provider's aliases are used.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'16.8':21 'abort':44 'alia':31 'alias-bas':30 'api':9,50 'automat':11,43 'base':32,46 'built':36 'built-in':35 'cancel':13 'configur':33,45 'depend':19 'differenti':41 'fetch':2,8,52 'fetch-yo-mama':1 'hook':6,28,54 'javascript':51 'loading/error':38 'mama':4 'manag':40 'peer':18 'provid':22 'react':5,20,55 'request':12 'simpl':49 'state':39 'typescript':17,56 'unmount':15 'url':47 'usedelet':27 'usefetch':53 'useget':23 'usepatch':26 'usepost':24 'useput':25 'v0.3.0-rc.2':16 'yo':3","created_at":"2026-06-07T16:52:41.089378+00:00","updated_at":"2026-06-07T16:52:41.089378+00:00","problems":[{"fix":"Wrap your component tree with <FetchProvider> and ensure aliases are defined.","cause":"Calling useGet without wrapping in FetchProvider results in undefined state.","error":"Uncaught TypeError: Cannot destructure property 'loading' of 'usersRequest' as it is undefined."},{"fix":"Always call hooks at the top level and destructure exactly [state, fetch, abortRef, clearState].","cause":"Destructuring the return of useGet incorrectly or conditionally calling hooks.","error":"Warning: React has detected a change in the order of Hooks called by Component."},{"fix":"Provide a string URL as the first argument: useGet('/users').","cause":"Using useGet without arguments or passing a non-string URL.","error":"TypeError: fetch is not a function"},{"fix":"Add a 'default' alias in FetchProvider aliases object.","cause":"FetchProvider was given aliases without a 'default' entry, or the provider is missing.","error":"Error: No alias found for 'default'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/alexandrius/fetch-yo-mama#readme","github":"https://github.com/alexandrius/fetch-yo-mama","docs":null,"changelog":null,"pypi":null,"npm":"fetch-yo-mama","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}