react-use-config is a React Hook (useConfigParam) for dynamically retrieving configuration parameters with well-defined priorities.
The useConfigParam hook retrieves parameter values in the following priority order:
- Query Parameter: Retrieved directly from the URL.
 - Environment Variable: Defined in the 
.envfile (prefixed withREACT_APP_). - Default Value: A fallback provided by the user.
 
import useConfigParam from 'react-use-config'; // Retrieve the 'geoServer' parameter with a default value const geoServer = useConfigParam('geoServer', 'http://localhost:8080/geoserver/isagro/wms'); // Retrieve the 'showMap' parameter with a default value const showMap = useConfigParam('showMap', true);- Flexibility: Enables dynamic configurations based on environment variables and URLs.
 - Simplicity: Reduces complexity in configuration management.
 - Convenience: Easy integration with React projects using React Router.
 
Add the repository to your project with:
npm install react-use-configFor additional details and a live preview of this project, visit the React Use Config GitHub Page.
We welcome contributions! Follow these steps:
- Fork the project.
 - Create a branch for your feature/bugfix (
git checkout -b my-feature). - Commit your changes (
git commit -m 'My new feature'). - Push to the branch (
git push origin my-feature). - Open a pull request.
 
MIT
🚀 Built with ❤️ by Ricardo Malnati and the amazing open-source community!


