React Use Config

Efficiently manage configuration parameters in React projects.

What is React Use Config?

React Use Config provides the useConfigParam hook to retrieve configuration values with the following priority:

  1. Query Parameters: Extracted directly from the URL.
  2. Environment Variables: With the prefix REACT_APP_.
  3. Default Values: Used when no other option is available.
Streamlining React Configurations

Features

Features Enhancing useConfigParam Hook

Configuration Retrieval Funnel

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

Configuration Value Retrieval Funnel

Getting Started

Follow these steps to start using React Use Config:

  1. Install the package:
  2. npm install react-use-config
  3. Import the hook in your project:
  4. import useConfigParam from 'react-use-config';
  5. Example usage:
  6. 
    const geoServer = useConfigParam('geoServer', 'http://localhost:8080/geoserver');
    console.log(geoServer); // Output based on priority
                    

🚀 Built with ❤️ by Ricardo Malnati and the amazing open-source community!

This project is free and open-source under the MIT License. Contributions are always welcome!

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.