React Native - Project Setup / Initialization / Environment configuration - Windows

 There are two types of React Native Application environments.

1. React Native CLI

2. Expo React Native


Which one to Choose?

React Native CLI
If you want full native access where you can deal with native code and Third-party SDKs you can go with React Native CLI. Which gives you full control of the framework. 

Expo React Native
It will make you develop your apps faster and came with lots of packages. Expo has many APIs that you can use in your projects. You can also eject from Expo to React Native CLI if required in the future.

Recommendation

I am writing this answer after using expo bare workflow for several years.

I  recommend using react-native CLI over expo bare workflow because of the regions below.

  1. Expo bare workflow is not developed by Facebook, so when there is a new update in RN CLI, the expo takes 1-2 months to add in its workflow.
  2. You can not control the size of the app because the expo includes a pre-included library in SDK. (minimum prod build starts from 29MB-38MB)
  3. App deployment and coding styling are the same in both bare-work flow RN Cli, so why not use React native CLI.
  4. Ejecting an expo in the middle of an ongoing project is a really painful process.
  5. you may (very rarely) face compatibility issues with external lib.
  6. upgrading expo is also painful for larger code base apps.

When to use expo bare workflow
if you have a good understanding of react native architecture and know the depth of technical requirements of the project. Also, you should aware of available expo libraries and how many things you are going to use in your project and you are not bothered about app size too.



React Native CLI Setup

Official doc link: https://reactnative.dev/docs/environment-setup


Windows Environment 

  1. Node JS (LTS) Version    -  Eg:16.15.1
  2. OpenJDK11
      For Installing the above install chocolaty into your windows machine
           1. Open CMD/Powershell in Administrator mode
            


            2. paste the below command and press enter

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))     


            Now Chocolaty installed into your system
            Now paste the below commands to install the node and Open JDK

    choco install -y nodejs-lts openjdk11 
       
    After above install the below applications
  1. Android Studio (https://developer.android.com/studio)
  2. Code Editor (VS Code)     (https://code.visualstudio.com/)

    Once you are done with the installation, move further with Environment Settings

    1. Search for the environment option in the start menu



    2. Click on Environment Variables
    3. Click on First New Button set below the values
                 Variable Name : JAVA_HOME
                 Variable Value : PATH to the folder where OpenJDK is installed

                Variable Name : ANDROID_HOME
                Variable Value : PATH to the folder for Android SDK         




    

    4. Once you are done add Android Tools path into the Path Key (Check Image below)

    5. Press OK and you are done with setting up React Native CLI environment.



Now You are good to start with RN Project! Happy Coding


 





    
   

Post a Comment

Previous Post Next Post