Let's explore some development gestures and how to execute them efficiently in the mobile world. When making a JavaScript change, Mitra's Watchman listener system aggregates it to the bundle and triggers reloads. For native changes, the code needs to be compiled and included in the app, requiring a rebuild. Installing JavaScript dependencies can be done with YARN install, while native dependencies require running react native run iOS. Starting the app daily only requires a Mitra server, the previous device, and the installed application.
Now that we've got this, let's take a look at a few development gestures from the daily live and see how we can execute them efficiently in our mobile world. The first thing you do when you develop is well, you develop. So you make a change, a JavaScript change. This different recipe in here is the one of Mitra. Mitra has a listener system that's called Watchman that will listen to the changes you make inside the code. And when you add some JavaScript, it will aggregate it to the bundle and trigger reloads. So to see our changing our app, thanks to the hot reload, we really just need to save our code.
Now another kind of change, a trickier one that you may do in the code is a native change. This new native code you added has to be compiled and included in our app. It corresponds to this step in our tree. What we need to realize here is that this compilation process will produce a whole new app and install it on our phone. It will completely override the previous application we had installed. So to see our new native change, we have to rebuild our app, either by running React Native run iOS or by building it with Xcode.
Okay, what else do we do frequently? Oh, libraries! Say that your app is running, you are happily coding and you need to install a new JavaScript dependency. What you need to do here is just run YARN install. You see, Mitro watches our source code but it also watches our node modules. So you run YARN install and Mitro will aggregate this change to the bundle. But we don't only depend on JavaScript dependencies. We rely on some native dependencies as well. So if you added a new native dependency by running prod install, which is the command we use to add some native iOS dependency, the iOS equivalent of YARN install. If you added this new library, this new native library, this is some new native code that has to be compiled as well. So it corresponds to this step in R3. So you have to run react native run iOS to build your app again.
Now the main gesture that I wanted to check with you today is this one, how you start your app on a daily basis. Because like I said, I used to run React native run iOS every day to launch my app, but it really wasn't necessary. You see, when you run this command, you go through all of those steps, including the native code compilation, which really takes the biggest amount of time here. But unless you added a new native library during the night, you don't need to do this. Your app is already installed somewhere on a simulator in your computer. What you need to start your app is really three things. A Mitra server, the device you used the day before, and the application installed on that device.
Comments