Read here for environment set up | Skip if your environment is ready
https://reactnative.dev/docs/environment-setup
First, you will need to install all dependencies to run this app
npm install
First, you will need to start Metro, the JavaScript bundler that ships with React Native. Metro "takes in an entry file and various options, and returns a single JavaScript file that includes all your code and its dependencies."— Metro Docs
To start Metro, run npx react-native start
inside your React Native project folder:
npx react-native start
react-native start
starts Metro Bundler.
If you use the Yarn package manager, you can use
yarn
instead ofnpx
when running React Native commands inside an existing project.
If you're familiar with web development, Metro is a lot like webpack—for React Native apps. Unlike Kotlin or Java, JavaScript isn't compiled—and neither is React Native. Bundling isn't the same as compiling, but it can help improve startup performance and translate some platform-specific JavaScript into more widely supported JavaScript.
Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:
npx react-native run-android
Or on iOS:
npx react-native run-ios
I use port 3004, you can use the same port or change to other port is 3004 is already in use
Let local fake rest api run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:
npx json-server --watch ./FakeAPI/db.json --port 3004
If everything is set up correctly, you should see your local fake rest api is running.