# getResourceName

## Overview

The `getResourceName` utility is a FiveM-specific function that retrieves the name of the current resource in which the script is running. It leverages the native `GetParentResourceName` function, ensuring seamless compatibility within the FiveM framework. This utility is lightweight, requiring no additional dependencies, and is particularly useful for dynamically referencing the resource name in logs, debugging, or API calls within a FiveM project.

## Usage

### **Importing the Utility**

```typescript
import { getResourceName } from "@yourpackage/utils";
```

### Parameters

This function does not accept any parameters.

### Return Value

The function returns a string representing the name of the parent resource in which it is executed.

## Example

```typescript
import { getResourceName } from "@yourpackage/utils";

export const MyComponent = () => {
    const resourceName = getResourceName();

    return (
        <div>
            Current Resource: {resourceName}
        </div>
    );
};
```

### How It Works

1. The `getResourceName` function is imported into the component.
2. The function is called, returning the name of the currently executing resource.
3. The returned resource name can be used dynamically within the component.

## Notes

* The function calls the FiveM native `GetParentResourceName` to obtain the resource name.
* It ensures TypeScript compatibility by properly handling the function's return type.
* Useful for debugging, logging, or dynamically constructing resource-specific URLs and API calls.
* No additional dependencies are required for this functionality.

## Conclusion

The `getResourceName` utility is a simple yet effective function for retrieving the name of the current resource in a FiveM script. By leveraging FiveM’s built-in `GetParentResourceName` function, it ensures efficiency and reliability. This function is particularly useful for debugging, logging, or dynamically referencing the resource name in various parts of a FiveM project.
