{"id":16292684,"url":"https://github.com/zeljkox/react-native-declarative-fetch","last_synced_at":"2026-05-06T01:36:11.119Z","repository":{"id":57336481,"uuid":"153102538","full_name":"zeljkoX/react-native-declarative-fetch","owner":"zeljkoX","description":"React Native Component for decalarative fetching","archived":false,"fork":false,"pushed_at":"2018-10-23T11:03:50.000Z","size":116,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-14T15:11:31.182Z","etag":null,"topics":["fetch","react","react-native"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zeljkoX.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}},"created_at":"2018-10-15T11:36:56.000Z","updated_at":"2023-03-11T12:21:00.000Z","dependencies_parsed_at":"2022-09-03T07:20:44.467Z","dependency_job_id":null,"html_url":"https://github.com/zeljkoX/react-native-declarative-fetch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeljkoX%2Freact-native-declarative-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeljkoX%2Freact-native-declarative-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeljkoX%2Freact-native-declarative-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zeljkoX%2Freact-native-declarative-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zeljkoX","download_url":"https://codeload.github.com/zeljkoX/react-native-declarative-fetch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008630,"owners_count":21032556,"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":["fetch","react","react-native"],"created_at":"2024-10-10T20:08:27.694Z","updated_at":"2025-10-19T19:27:06.961Z","avatar_url":"https://github.com/zeljkoX.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native Declarative Fetch [IN PROGRESS]\n\nClient - Server communication in declarative way.\n\n\n## Inspiration\n\nInspired by Apollo GraphQL library.\n\n\n## Why?\n\nSetting fetch function on every call is tedious. Declarative code adds readability factor.\n\n## Installation\n\n`yarn add react-native-declarative-fetch`\n\n## Quick Start\n```javascript\n\nimport {QueryProvider, Query} from 'react-native-declarative-fetch'\n\nexport default class App extends Component {\n\n  render() {\n    return (\n      \u003cQueryProvider\n        defaultMethod='GET'\n        endpoints={{default: 'http://localhost:8081', v1: 'http://localhost:8082'}}\n        defaultHeaders={{acceptLanguage: 'en'}}\u003e\n        \u003cQuery url='test'\u003e{\n          ({data, error, loading}) =\u003e {\n            if (loading) {\n              return \u003cText\u003eLoading\u003c/Text\u003e\n            }\n            if (error) {\n              return \u003cText\u003eError\u003c/Text\u003e\n            }\n            return \u003cText\u003e{data}\u003c/Text\u003e\n          })\n        }\u003c/Query\u003e\n      \u003c/QueryProvider\u003e\n    )\n  }\n}\n```\n\n## Props\n\n### QueryProvider\n\nQueryProvider takes default configuration which is used by every Query component nested inside QueryProvider.\nShould be add to app top level.\n\nkey | type | Value | Description\n------ | ---- | ------- | ----------------------\nendpoints | Object |  | Mapping of used endpoints.\ndefaultMethod | String | GET | Default Http method.\ndefaultHeaders | Object | {} | Default Http headers.\nonError | Function | () =\u003e {} | Default error handler. Invoked on every Query error.\n\n\n### Query\n\nkey | type | Value | Description\n------ | ---- | ------- | ----------------------\nmethod | String | GET | If not defined QueryProvider defaultMethod is used.\nheaders: Object | {} | If not defined QueryProvider defaultHeaders is used.\nurl | String |  | Required field, url that is added to QueryProvider endpoint.\nskip | Boolean | false | Skip fetch in React componentDidMount lifecycle method.\nvariables | Object | {} | Data to be used with Post request.\nonError | Function | () =\u003e {} | Callback to be invoked on failed request. Fallback to QueryProvider onError callback.\n};\n\nProps passed to children function:\n\nkey | type | Value | Description\n------ | ---- | ------- | ----------------------\ndata | Object | | Response value.\nerror | Boolean | | Flag to indicate query error.\nloading | Boolean | | Flag to indicate ongoing request.\nfetch | Function | | Conditionally fetch\n\n## TODO\n\n- Add tests\n- Refactor code\n- Fix grammar\n\n## License\n\nMIT License. © Željko Marković 2018\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeljkox%2Freact-native-declarative-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeljkox%2Freact-native-declarative-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeljkox%2Freact-native-declarative-fetch/lists"}