loading...
Cover image for Lessons after 1 Week with React Native

Lessons after 1 Week with React Native

luvi profile image Janique-ka John ・2 min read

React Native seemed like the best choice for me as I prototype an app. The one thing standing in my way was the fact that.... I have never used React.

Still, it seemed like a waste of time to first try to learn React, which I had no opportunity to use, and THEN apply what I've learnt to React Native... long story short, seven days later I feel like I'm getting the hang of things.

Lesson #1 - React Native is not a web wrapper

If you have heard of or used Cordova (I actually used this technology to make a few apps back when I was in Uni), React Native is not it. The javascript itself is not being wrapped in some shell and displayed on android/iOS! The code you write in React Native is translated to actual native code. To further emphasize this, you can chose to stop using react native and continue in your native language of choice instead. Which leads me to lesson 2...

Lesson #2 - Code with your platform(s) of choice in mind

As I alluded to above, development in react native translates to native, platform specific code. For this reason I've found it useful to focus on the platform I'm aiming for. For now, I am focusing on iOS and learning about CocoaPods, and all of the specific actions Apple requires to get successful build. (Bonus tip, ensure that you open the .xcworkspace version of your app in XCode)

Lesson #3 - Restart and refresh your simulator

You know the old adage... Have you tried turning it on and off again?

If you are depending on the feedback from the simulator to see how you are going, I encourage you to regularly close and restart your bundler process and your simulator (sometimes even delete the app from the simulator). I can't tell you how much time I lost initially, trying to clear or find the solution to errors that were simply to be solved by giving the setup a refresh.

For iOS development - pod deintegrate, then pod install (cd into the iOS folder first) has solved many an issue.

Lesson #4 - Linking - sometimes it's automatic, sometimes it's not

At a time before my start with React Native, you had to link dependencies yourself. Nowadays, the React Native CLI auto-links, but not for every dependency! Some have yet to switch over, and so I encourage you to read the docs of your new module carefully to see if you have to run react-native link dependency-name in order to add the modules.

P.S Overall this has been fun, so much fun that I could barely put it down to stop and reflect on the lessons for this week. Let me know if I should continue sharing my newbie perspective and visit my twitter page @JaniquekaJohn for more frustration, random tweets and OMG It Works! moments as I continue on this journey.

P.S.S I am also learning things about react through learning React Native, during this journey, such as the component lifecycle (which is actually about to change from your typical componentWillMount etc) Let me know if I should write about learning React through React Native!

Posted on by:

luvi profile

Janique-ka John

@luvi

Junior Software Engineer interested in web technologies and learning more in general!

Discussion

markdown guide