# useConfig

useConfig is a helper hook that will return the plugin config

## How to use

```jsx
import { Plugin } from '@root'

const MyCustomComponent = () => {
    const config = Plugin.useConfig()
    
    return (
        <div>
            <p>title: {config.title}</p>
        </div>
    )
}

export default MyCustomComponent
```

useConfig accepts a selector as an argument to select a part of the config instead of returning all the config object

Let's say that your config looks something like this:

```javascript
{
    [...]
    
    service: {
        endpoint: "http://my-awsome-service.com",
        credentials: {
            username: "mr.awesome",
            password: "supper-secret"
        }
    }
    
    [...]
}
```

And you want to use the `service` object in your code:

```jsx
import { Plugin } from '@root'
import { useEffect } from 'react'

const MyCustomComponent = () => {
    const service = Plugin.useConfig(config => config.service)
    
    useEffect(() => {
        connect(service.endpoint, service.credentials})
    }, [])
}

export default MyCustomComponent
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.navigaglobal.com/dashboard-plugin/api-and-gui/api/useconfig.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
