React Native Tutorial Step 12 - Constants.js

Опубликовано: 17 Февраль 2026
на канале: CourseHack
977
2

Today's tutorial we're going to be working on setting up our API configurations. So, go ahead, your first job:

TODO #1: Create a services/api/ folder under src/ - so you will have /src/services/api

TODO #2: Create a constants.js under the /src/services/api folder.

In this constants.js file, we will be handling a lot of things, such as environments. Yes, with expo, you can code for different environments (i.e. development, staging, production). 

TODO #3: Copy the following code in the video into your constants.js file.

TODO #4: Use the ip retrieved by ifconfig and replace the "xxx.xxx.xxx.xxx" in api_url = 'http://xxx.xxx.xxx.xxx:3001'

Interested in our medium post? Check out   / react-native-tutorial-step-12-constants-js  

Don't forget to like, comment, and subscribe!!!

========================================================
Reference Links
========================================================
ifconfig: https://en.wikipedia.org/wiki/Ifconfig
========================================================
Connect with me!
========================================================
Linkedin:   / donaldlee50  
Instagram:   / donlee50  
Twitter:   / donaldlee50  
Youtube:    / coursehack  
Mailing List: http://bit.ly/coursehack-mailing-list
Coursehack's Facebook Group: bit.ly/join-coursehack-facebook-group

Don't forget to like, comment, and subscribe!