What is React Use Config?
React Use Config provides the useConfigParam
hook to retrieve configuration values with the following priority:
- Query Parameters: Extracted directly from the URL.
- Environment Variables: With the prefix
REACT_APP_
. - Default Values: Used when no other option is available.

Features
- Retrieve parameters dynamically from multiple sources.
- Automatic boolean conversion for
true
andfalse
. - Customizable default values.
- Lightweight and easy to integrate.

Configuration Retrieval Funnel
The following diagram demonstrates the priority order for retrieving configuration values:

Getting Started
Follow these steps to start using React Use Config:
- Install the package:
- Import the hook in your project:
- Example usage:
npm install react-use-config
import useConfigParam from 'react-use-config';
const geoServer = useConfigParam('geoServer', 'http://localhost:8080/geoserver');
console.log(geoServer); // Output based on priority
Contribute
We welcome contributions! Open an issue or submit a pull request on the GitHub Repository.
Learn More
For more details, visit the GitHub Repository.