> For the complete documentation index, see [llms.txt](https://fivem-react.gitbook.io/fivem-react/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fivem-react.gitbook.io/fivem-react/utils/is-production.md).

# isProduction

## Overview

This utility is designed to help determine whether the application is running in production mode (e.g., a game environment) or development mode (e.g., a browser environment). It provides a simple function that serves as an alternative to repeatedly checking `process.env.NODE_ENV === 'production'`.

By using this utility, developers can streamline their code and avoid redundant checks, ensuring a cleaner and more maintainable codebase. It is especially useful in distinguishing between different execution environments for various configurations or logging purposes.

## Usage

### Importing the Utility

```tsx
import { isProduction } from "@yankes/fivem-react/utils";
```

## Example

### In Game

```tsx
import { useState } from "react"; 
import { isProduction } from "@yankes/fivem-react/utils";

export const MyComponent = () => {
    const [playerName, setPlayerName] = useState<string | null>("john.doe");

    return (
        <div>
            {isProduction() && playerName ? `Hi, ${playerName}!` : "You can see this content only in in game!"} // Hi, john.doe!        
        </div>
    )
}
```

### In Browser

```tsx
import { useState } from "react"; 
import { isProduction } from "@yankes/fivem-react/utils";

export const MyComponent = () => {
    const [playerName, setPlayerName] = useState<string | null>("john.doe");

    return (
        <div>
            {isProduction() && playerName ? `Hi, ${playerName}!` : "You can see this content only in in game!"} // You can see this content only in in game!        
        </div>
    )
}
```
