<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Tan</title>
    <description>The latest articles on DEV Community by Tan (@tan_22).</description>
    <link>https://dev.to/tan_22</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2943077%2F1d1638ec-642b-466c-8c54-15b7ac39c441.png</url>
      <title>DEV Community: Tan</title>
      <link>https://dev.to/tan_22</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tan_22"/>
    <language>en</language>
    <item>
      <title>PHP sqlyog</title>
      <dc:creator>Tan</dc:creator>
      <pubDate>Mon, 18 Aug 2025 02:38:47 +0000</pubDate>
      <link>https://dev.to/tan_22/php-sqlyog-3kfo</link>
      <guid>https://dev.to/tan_22/php-sqlyog-3kfo</guid>
      <description></description>
      <category>php</category>
      <category>database</category>
      <category>sql</category>
    </item>
    <item>
      <title>How to Use Environment Variables in React Native Expo Project</title>
      <dc:creator>Tan</dc:creator>
      <pubDate>Tue, 24 Jun 2025 15:53:57 +0000</pubDate>
      <link>https://dev.to/tan_22/how-to-use-environment-variables-in-react-native-1jle</link>
      <guid>https://dev.to/tan_22/how-to-use-environment-variables-in-react-native-1jle</guid>
      <description>&lt;p&gt;With the release of React Native 0.80 and Expo SDK 50, working with environment variables has become more streamlined and secure, thanks to native support built directly into the Expo CLI.&lt;br&gt;
In this blog post, we’ll explore how to properly configure and use environment variables in an Expo-managed React Native project.&lt;/p&gt;
&lt;h2&gt;
  
  
  What Are Environment Variables?
&lt;/h2&gt;

&lt;p&gt;Environment variables are key-value pairs that define runtime configuration without hardcoding sensitive or environment-specific data directly into your application. Typical use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switching API base URLs&lt;/li&gt;
&lt;li&gt;Managing third-party service keys&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  Setting Up Environment Variables in Your React Native Expo Project
&lt;/h2&gt;

&lt;p&gt;Expo automatically reads from &lt;code&gt;.env&lt;/code&gt; files and injects any variable prefixed with &lt;code&gt;EXPO_PUBLIC_&lt;/code&gt;into your JavaScript code.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a .env file in the root of your project:
&lt;code&gt;.env&lt;/code&gt; file
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;EXPO_PUBLIC_DATABASE_URL=https://api.example.com
EXPO_PUBLIC_SECRET_KEY=DWADAFA
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;✅ Only variables that begin with &lt;code&gt;EXPO_PUBLIC_&lt;/code&gt; will be available in your app via &lt;code&gt;process.env.&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Using Environment Variables in Code
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const secretKey = process.env.EXPO_PUBLIC_SECRET_KEY;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;⚠️ Only static dot notation (&lt;code&gt;process.env.VARIABLE&lt;/code&gt;) is supported. Destructuring or dynamic access will not work&lt;/p&gt;
&lt;h2&gt;
  
  
  Using Multiple Environments
&lt;/h2&gt;

&lt;p&gt;Expo supports standard dotenv file resolution, allowing multiple environment configurations:&lt;br&gt;
&lt;code&gt;.env&lt;/code&gt; — Default environment&lt;br&gt;
&lt;code&gt;.env.local&lt;/code&gt;— Machine-specific overrides (should be added to .gitignore)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.gitignore&lt;/code&gt; file&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.env*.local
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;With native support for environment variables in React Native 0.80 and Expo SDK 50, managing multiple environments is now more streamlined, secure, and developer-friendly. By following best practices—like using &lt;code&gt;EXPO_PUBLIC_&lt;/code&gt; prefixes, avoiding secrets in the frontend, and leveraging &lt;code&gt;.env.local&lt;/code&gt; for local overrides—you can simplify your configuration workflow while keeping your codebase clean and scalable&lt;/p&gt;

&lt;h2&gt;
  
  
  📚 Further Reading
&lt;/h2&gt;

&lt;p&gt;For more details, check out the official Expo documentation:&lt;br&gt;
&lt;a href="https://docs.expo.dev/guides/environment-variables/" rel="noopener noreferrer"&gt;https://docs.expo.dev/guides/environment-variables/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>reactnative</category>
      <category>environmentvariables</category>
    </item>
  </channel>
</rss>
