# How can I set environment in card react code?

**URL:** <https://community.hubspot.com/t/how-can-i-set-environment-in-card-react-code/146250>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [February 16, 2026, 3:43am UTC](https://community.hubspot.com/t/how-can-i-set-environment-in-card-react-code/146250 "2026-02-16T03:43:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JZhao](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jzhao/32/98997_2.png) [@JZhao](https://community.hubspot.com/u/JZhao)\
**Post date:** [February 16, 2026, 3:43am UTC](https://community.hubspot.com/t/how-can-i-set-environment-in-card-react-code/146250/1 "2026-02-16T03:43:12Z")

</div>

I have below code to return Card context:

```

fetch(url)…

return (  
\<\>  
\<EmptyState title=“Payment” layout=“vertical” imageName=“building”\>  
\<Text\>Transaction\</Text\>  
\</EmptyState\>  
\</\>  
);

```

In above code, I need to determinte the environment it is running. The environment can be developer, test, staging and prod. These enviroments are critical for our software development lifecycle. The code would be a little different for different environments. e.g. the fetch URL is different based on the environment. How can I pass the environment name to this code?

---

<div class="post-metadata">

**Author:** ![Victor\_Becerra](https://avatars.discourse-cdn.com/v4/letter/v/87869e/32.png) [@Victor\_Becerra](https://community.hubspot.com/u/Victor_Becerra)\
**Post date:** [February 16, 2026, 5:10pm UTC](https://community.hubspot.com/t/how-can-i-set-environment-in-card-react-code/146250/2 "2026-02-16T17:10:46Z")

</div>

Hi @JZhao

Thanks for posting! I want to share a couple of resources for your exact same issue:

> **[Build with config profiles - HubSpot docs](https://developers.hubspot.com/docs/developer-tooling/local-development/build-with-config-profiles)**
>
> Learn how to set up and use config profiles in a project to streamline building and testing apps.

And these Community Threads  
[https://community.hubspot.com/t5/CMS-Development/Where-to-put-env-file-in-CMS-React-Boilderplate/m-p/411218](https://community.hubspot.com/t5/CMS-Development/Where-to-put-env-file-in-CMS-React-Boilderplate/m-p/411218)

[https://community.hubspot.com/t5/CMS-Development/How-to-use-environment-variables/m-p/306673](https://community.hubspot.com/t5/CMS-Development/How-to-use-environment-variables/m-p/306673)

I’m tagging a few experts who can help us out here. Hey there, @evaldas , @DilshadShaikh , and @kosalaindrasiri . I hope you’re having a great week! Any ideas for this issue?

Thanks

Victor
