{"id":23002476,"url":"https://github.com/malnati/react-use-config","last_synced_at":"2026-02-14T18:31:35.035Z","repository":{"id":267844951,"uuid":"902495495","full_name":"Malnati/react-use-config","owner":"Malnati","description":"Provides a hook called useConfigParam to retrieve configuration parameters with priority: URL query, environment variables, and default value. It simplifies configuration management, enabling flexibility and adaptability across different environments and scenarios.","archived":false,"fork":false,"pushed_at":"2025-03-10T19:21:20.000Z","size":919,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T18:36:32.217Z","etag":null,"topics":["adaptive","config-management","developer-tools","dynamic-configuration","environment-variables","hook","javascript","npm","param","react","settings","tested","typescript","url-parameters"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/react-use-config","language":"TypeScript","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/Malnati.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-12T17:16:23.000Z","updated_at":"2024-12-22T13:11:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"eeafdb6f-7f65-4576-8c08-86e4a8c2e8ab","html_url":"https://github.com/Malnati/react-use-config","commit_stats":null,"previous_names":["malnati/react-use-config"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Malnati%2Freact-use-config","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Malnati%2Freact-use-config/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Malnati%2Freact-use-config/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Malnati%2Freact-use-config/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Malnati","download_url":"https://codeload.github.com/Malnati/react-use-config/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250318318,"owners_count":21410914,"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":["adaptive","config-management","developer-tools","dynamic-configuration","environment-variables","hook","javascript","npm","param","react","settings","tested","typescript","url-parameters"],"created_at":"2024-12-15T07:11:09.872Z","updated_at":"2026-02-14T18:31:34.989Z","avatar_url":"https://github.com/Malnati.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# react-use-config\n\n`react-use-config` is a React Hook (`useConfigParam`) for dynamically retrieving configuration parameters with well-defined priorities.\n\n![Build Status](https://img.shields.io/badge/build-passing-brightgreen)\n![License](https://img.shields.io/badge/license-MIT-blue)\n![Coverage](https://img.shields.io/codecov/c/github/Malnati/react-use-config)\n![Version](https://img.shields.io/npm/v/react-use-config)\n![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen)\n![Downloads](https://img.shields.io/npm/dt/react-use-config)\n\n---\n\n## Features\n\nThe `useConfigParam` hook retrieves parameter values in the following priority order:\n\n1. **Query Parameter**: Retrieved directly from the URL.\n2. **Environment Variable**: Defined in the `.env` file (prefixed with `REACT_APP_`).\n3. **Default Value**: A fallback provided by the user.\n\n---\n\n### Visual Overview\n\n#### Streamlining React Configurations\n![Streamlining React Configurations](https://raw.githubusercontent.com/Malnati/react-use-config/main/docs/Streamlining-React-Configurations.png)\n\n#### Features Enhancing `useConfigParam`\n![Features Enhancing useConfigParam Hook](https://raw.githubusercontent.com/Malnati/react-use-config/main/docs/Features-Enhancing-useConfigParam-Hook.png)\n\n#### Configuration Retrieval Funnel\n![Configuration Value Retrieval Funnel](https://raw.githubusercontent.com/Malnati/react-use-config/main/docs/Configuration-Value-Retrieval-Funnel.png)\n\n---\n\n## Usage Example\n\n```javascript\nimport useConfigParam from 'react-use-config';\n\n// Retrieve the 'geoServer' parameter with a default value\nconst geoServer = useConfigParam('geoServer', 'http://localhost:8080/geoserver/isagro/wms');\n\n// Retrieve the 'showMap' parameter with a default value\nconst showMap = useConfigParam('showMap', true);\n```\n\n---\n\n## Benefits\n\n- **Flexibility**: Enables dynamic configurations based on environment variables and URLs.\n- **Simplicity**: Reduces complexity in configuration management.\n- **Convenience**: Easy integration with React projects using React Router.\n\n---\n\n## Installation\n\nAdd the repository to your project with:\n\n```bash\nnpm install react-use-config\n```\n\n---\n\n## Learn More\n\nFor additional details and a live preview of this project, visit the [React Use Config GitHub Page](https://malnati.github.io/react-use-config).\n\n---\n\n## Contributing\n\nWe welcome contributions! Follow these steps:\n\n1. Fork the project.\n2. Create a branch for your feature/bugfix (`git checkout -b my-feature`).\n3. Commit your changes (`git commit -m 'My new feature'`).\n4. Push to the branch (`git push origin my-feature`).\n5. Open a pull request.\n\n---\n\n## License\n\nMIT\n\n---\n\n🚀 Built with ❤️ by **Ricardo Malnati** and the amazing open-source community!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalnati%2Freact-use-config","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmalnati%2Freact-use-config","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmalnati%2Freact-use-config/lists"}