<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Peter Steinberg on Medium]]></title>
        <description><![CDATA[Stories by Peter Steinberg on Medium]]></description>
        <link>https://medium.com/@objectliteral_46655?source=rss-be3022822e66------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*B9ANMX8AfsQyq7C7.jpg</url>
            <title>Stories by Peter Steinberg on Medium</title>
            <link>https://medium.com/@objectliteral_46655?source=rss-be3022822e66------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 20:57:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@objectliteral_46655/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup & First  Steps— React Native Mobile App Development Part 1]]></title>
            <link>https://medium.com/enpit-developer-blog/setup-first-steps-react-native-mobile-app-development-part-1-e8a0b0034898?source=rss-be3022822e66------2</link>
            <guid isPermaLink="false">https://medium.com/p/e8a0b0034898</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Fri, 11 Jan 2019 11:19:18 GMT</pubDate>
            <atom:updated>2019-01-11T11:19:18.776Z</atom:updated>
            <content:encoded><![CDATA[<h3>Setup &amp; First Steps— React Native Mobile App Development Part 1</h3><p><em>This is part 1 in a series of articles about mobile app development with React Native.</em></p><p>In this article, you will learn how to bootstrap your first React Native project. We will cover the options you have and walk through the first steps together.</p><p>In case you are wondering why you would want to use React Native in the first place, check out <a href="https://medium.com/p/b2b6e38b67a6">the 0th part of this series</a>, where some alternative technologies for mobile app development are discussed.</p><h3>Setup. Your Options</h3><p>There are two ways to go about setting up your first React Native project. The two bootstrapping tools you might want to use are create-react-native-app (CRNA)/Expo CLI and the react-native CLI. We will look at both here.</p><p>So what’s the difference? Well, CRNA and the Expo CLI used to be two different things, but <a href="https://blog.expo.io/expo-cli-2-0-released-a7a9c250e99c">have been merged into one tool by now</a>. They bootstrap a React Native project with a couple of enticing bells and whistles: A more flexible development tooling and a set of useful native components. react-native init will also setup a project for you but keeps it slightly simpler: Apart from your JavaScript source you end up with pre-configured projects for Xcode and Android Studio, which you will need to compile in order to run your app.</p><h4>CRNA / Expo</h4><p>The team at <a href="https://expo.io/">Expo</a> tries to streamline the React Native development process by providing a set of really convenient tools. If you want to take advantage of what they offer, you can start by bootstrapping a new React Native project with the Expo CLI. Expo abstracts away all of the native code that is part of a React Native project. This has some significant implications:</p><ul><li>Your project folder will not contain any native code and any app configuration is done through an expo-specific config file.</li><li>You can run your code inside the Expo Client app that is available for Android and iOS and loads the JavaScript bundle that your app consists of. This allows you e.g. to run on iOS without also having a macOS device (which otherwise would be needed to compile the iOS project).</li><li>Expo provides you with a set of APIs that expose native device capabilities like the camera to your JavaScript code. These are useful and well-maintained modules that make it easy to take advantage of native capabilities. Sadly, not every native API is already supported by Expo. As of this writing, Expo e.g. does not provide APIs for Bluetooth, WebRTC, background code execution <a href="https://docs.expo.io/versions/latest/introduction/why-not-expo">among other things</a>.</li><li>Since you don’t manage your app’s native code yourself, you can’t link native modules that you wrote yourself or that the community provides. This means that as soon as you want to do something, that Expo does not support, you are pretty much out of luck.</li><li>Expo provides a service to build application binaries in the cloud and to push updates of the JavaScript bundle to apps without going through an appstore update process. This can be really neat if you want to regularly push out updates to your users quickly.</li></ul><p>You have to decide for yourself, whether you want to take advantage of the Expo ecosystem or not. If you did set up your project using the Expo CLI and change your mind later on, you can easily opt out using expo eject, which generates iOS and Android projects for you.</p><p><strong>Getting Started</strong></p><p>Install the Expo CLI with npm i -g expo-cli and bootstrap your app using the following command:</p><pre>&gt; expo init -t blank myrnapp-expo<br>[14:48:41] Extracting project files...<br>[14:48:49] Customizing project...</pre><pre>Your project is ready at /Users/peter/myrnapp-expo<br>To get started, you can type:</pre><pre>  cd myrnapp-expo<br>  expo start</pre><p>Let’s take a look at what that command leaves us with:</p><pre>&gt; ls<br>App.js    app.json    assets    node_modules    package.json</pre><p>Expo-specific is the app.json file, which contains configuration that is usually contained in the native project files and that Expo passes along. Other than that there is not much to say: App.js contains your apps’s entry point and from there you can start writing your components (which we will get to in a bit).</p><p>To run the project you just bootstrapped, you need to install the Expo app (<a href="https://itunes.apple.com/us/app/expo-client/id982107779">iOS</a>, <a href="https://play.google.com/store/apps/details?id=host.exp.exponent">Android</a>) on your mobile device. On your computer use expo start to start the development server and then open the project in the Expo app. Under Android you can conveniently scan a QR code that the Expo CLI presents to you, while iOS users have to manually navigate to exp://X.X.X.X:19000 where X.X.X.X is the local IP address of your development machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/295/1*jNMsET7vX5kE4CYKyQwgyQ.jpeg" /><figcaption>When you see this, it means your setup works.</figcaption></figure><p>The first time, the JavaScript bundle gets create, it takes a few moments, but when it is ready, you will be greeted with a Hello-World-Screen.</p><p>Neat. We will look at the code in more detail in just a bit, but first, let us talk about the alternative setup method.</p><h4>“Native” with `react-native init`</h4><p>When you want nothing to do with Expo, their tooling and their SDK, you can initialize a traditional-style project that contains all the necessary sources that you need, in order to run an app on Android and iOS. This also means that you need the respective technology stacks available to run an app and test it out. To run on Android you need <a href="https://developer.android.com/studio/">Android Studio</a> (available for Windows, macOS and Linux) and either and Android device or an Intel CPU to run an emulator (without Intel’s HAXM software the emulator will be unbearingly slow). To test your app on iOS you need a machine with macOS and Xcode installed, and then you run the app either inside a simulator or your iOS device.</p><p>The overhead of having to compile the app yourself inside of Xcode or Android Studio and the platform limitations for testing (e.g. if you have an iPhone available but no Mac, you can not run the app on your device) might seem tedious. But at the same time you have the power of native at your fingertips: If your team includes native developers, they can make changes to the native part of the app in order to maybe solve some problems that you can not solve in JavaScript. This includes access to native capabilities: The React Native community provides a rich pool of packages that expose some native API to JavaScript and you can (more or less) easily include them in your project. On the one hand, this offers incredible flexibility in terms of the features that you can build, but on the other hand it might require some fiddling with the native projects. Assuming that your lack of native expertise brought you to React Native, this might be a turn-off.</p><p><strong>Getting Started</strong></p><p>Let’s create an app using the React Native CLI. Install the CLI using npm i -g react-native-cli and then use it to initialize a new project.</p><pre>&gt; react-native init myrnapp<br>This will walk you through creating a new React Native project in /Users/peter/myrnapp<br>Using yarn v1.9.4<br>Installing react-native…<br>yarn add v1.9.4<br>info No lockfile found.<br>[1/4] Resolving packages…<br>[2/4] Fetching packages…<br>.<br>.<br>.</pre><pre>├─ xml-name-validator@3.0.0<br>└─ yargs-parser@9.0.2<br>Done in 22.46s.<br>To run your app on iOS:<br> cd /Users/peter/myrnapp<br> react-native run-ios<br> — or -<br> Open ios\myrnapp.xcodeproj in Xcode<br> Hit the Run button<br>To run your app on Android:<br> cd /Users/peter/myrnapp<br> Have an Android emulator running (quickest way to get started), or a device connected<br> react-native run-android</pre><p>You will end up with dedicated folders containing the Xcode- and Android Studio projects respectively as well as a JavaScript file containing a Hello-World component just like in the Expo setup.</p><pre>&gt; ls<br>App.js    android    app.json    index.js    ios    node_modules    package.json    yarn.lock</pre><p>To get this running on your device requires slightly more work compared to the Expo variant: Open the project on Xcode or Android Studio (depending on your target device). You can launch the app in an emulator, but running it on a device is much more exciting and useful. For iOS you need to set up code signing with Xcode first — if you have not done that before, you may want to consult <a href="https://help.apple.com/xcode/mac/current/#/dev60b6fbbc7">Apple’s documentation.</a></p><h3>Code. At last</h3><p>Let’s finally look at the actual code that we start out with after having our project bootstrap by one of the two tools.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49aa31af297447eece546f8d2c4ebfea/href">https://medium.com/media/49aa31af297447eece546f8d2c4ebfea/href</a></iframe><p>For those of you who are familiar with React, the code will already make sense. If you have never seen React code, this might look a bit weird, but you will quickly get used to this syntax and structure.</p><p>The code above imports some basics from the react and react-native libraries, and defines a component that it then exports. This component is written as a JavaScript class that inherits from React.Component and contains a render method. As in React.js, every component needs to have a render method — you can even define you component as just that function, but we will be using classes per default.</p><p>The render method returns the UI component that is shown to the user. The return value of the render method is a <a href="https://reactjs.org/docs/introducing-jsx.html">JSX definition</a>. JSX is similar to HTML, but is written right into a JavaScript file and can include JavaScript expressions. Expressions inside JSX are written in curly braces like the value of the style attribute in the &lt;View&gt; component above.</p><p>Components are composed of other components. In the example above the structure is simple: A &lt;View&gt; (more or less corresponding to a &lt;div&gt; in the world of the web) is wrapped around a &lt;Text&gt; node — only &lt;Text&gt; components can directly include text in React Native.</p><p>Try and change the text, the component shows, and reload the app — if livereload is not already enabled you can fix that in the app’s debug menu that you open up by shaking the device or pressing CMD+R in the emulator.</p><p>The App.js file also includes some style definitions that are applied to the &lt;View&gt;. Just as in HTML, elements/components can be customized using the style attribute. React Native tries to emulate a bunch of CSS properties, but not all of them. You also have to use camel-case (compared to kebab-case in CSS) to achieve valid JavaScript syntax.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*OPI0DPdN17tyTHPCAop7cQ.jpeg" /></figure><p>Try rendering a different text by adding a color property to the stylesheet and give it either a hex-value or a color name like &#39;pink&#39;.</p><p>React Native uses the <a href="https://yogalayout.com/">Yoga</a> layout engine to position components on the screen, which works similar to the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox">CSS</a> <a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/">flexbox </a><a href="https://scotch.io/tutorials/a-visual-guide-to-css3-flexbox-properties">model</a>. You will quickly pick up how this works in the <a href="https://facebook.github.io/react-native/docs/flexbox">related React Native layout documentation</a>.</p><p>But I am getting ahead of myself. We work with the code in the coming parts of this series.</p><h3>Summing up</h3><p>In this post you have seen how to bootstrap your first React Native project and run it on your device. You can start writing native apps now, or you can stick around for the next article in which we will build a simple master-detail kind of application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8a0b0034898" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/setup-first-steps-react-native-mobile-app-development-part-1-e8a0b0034898">Setup &amp; First  Steps— React Native Mobile App Development Part 1</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[dotJS 2018 — Retrospective]]></title>
            <link>https://medium.com/enpit-developer-blog/dotjs-2018-retrospective-c7f860a33780?source=rss-be3022822e66------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7f860a33780</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[paris]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[dotjs]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Fri, 16 Nov 2018 13:07:22 GMT</pubDate>
            <atom:updated>2018-11-16T13:07:22.452Z</atom:updated>
            <content:encoded><![CDATA[<h3>dotJS 2018 — Retrospective</h3><p>Last week, <a href="https://www.dotjs.io/">dotJS</a> welcomed over 1500 JavaScript enthusiasts to Paris — <a href="https://medium.com/u/710d66df63c8">enpit</a> sent <a href="https://medium.com/u/f8d0cd2b08af">Janis Krasemann</a> and me along with them. The crowd was eager to listen to some of the industry’s most influential people talk about what we all love: JavaScript. A whole day of JS-goodness was in store for us and the dotJS team had done a fantastic job of curating a day with high-quality talks about different topics — <em>from type systems to Minecraft, from framework-hell to dancing robots.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*BLi0JLmOs7DpSNrmG1MyMw.jpeg" /><figcaption>The venue shortly before the talks began</figcaption></figure><h3>JavaScript in the field</h3><p>What are the interesting things that some of us do with JavaScript? How do we use it and what are technologies that we find intriguing?</p><p>The day started off with Sacha Greif (<a href="http://twitter.com/SachaGreif">@SachaGreif</a>) presenting the results of the 2018 edition of his <a href="https://stateofjs.com/">State of JavaScript survey</a>. The full results will be published soon, but some of the takeaways from a quick look at some of the most popular JS technologies were that:</p><p>- React is going strong with high usage numbers and high developer satisfaction, <br>- developers use Angular a lot, but are not quite so satisfied with their experience,<br>- Vue is on a great trajectory with a lot of interest from developers who are currently not yet using it, but hope to do so in the future<br>- GraphQL became more popular over the last two years, and while developers are definitely interested, it is not yet widely used</p><p>Besides the big contenders like Angular and React, new libraries and frameworks seem to pop up every day. The abundance of these has become so ridiculous that it has become a running gag in the scene. So how to actually choose a JavaScript framework? You can argue a lot about a framework’s number of stars on GitHub, available plugins, documentation, its pros and cons in various, and all of that is fine. But when talking to a couple of people from different framework camps, John Papa (<a href="http://twitter.com/john_papa">@john_papa</a>) found a common theme in their explanation of why they enjoy a certain framework: “It <em>feels</em> good”. John made the point that our productivity and enjoyment with a framework is subjective to us and we should not feel insecure about our framework of choice, when it feels right to <em>us</em>.</p><p>This question of <em>feeling</em> might very much apply to another technology — not a framework in this case — that seems to be more and more commonplace in the JS community.</p><h3>Not my type</h3><p>One of the technologies that, according to the State of JS survey, is seeing a growth in developers using it, is TypeScript.</p><blockquote>Oh, no! Another technology! Why would I need this?!</blockquote><p>Two separate talks made a strong case in favor of using TypeScript: By Lauren Tan, who approached the topic by giving a theoretical motivation for using type systems in general, and by the inventor of TypeScript himself, Anders Heijlsberg. Lauren (<a href="http://twitter.com/sugarpirate_">@sugarpirate_</a>) framed the topic in a smart way: By constraining the domain of the values in your code, you limit the possibility space for unexpected behavior. Of course it helps, that type systems correspond to algebraic models and proof theory, which provide solutions for analyzing such systems. In a sense, type annotations are propositions and code is proof, which allows algorithms to verify these propositions. The knowledge about our code that those algorithms gather, can help you and your IDE catch a lot of mistakes early, and reduce the number of ways that your program can fail.</p><p>In the JS environment there are two famous implementations of static type checking, one of them being TypeScript. Anders Heijlsberg (<a href="http://twitter.com/aheijlsberg">@aheijlsberg</a>), of Turbo Pascal- and C#-fame, created TypeScript at Microsoft and seems to work closely with the Visual Studio Code team to integrate TypeScript support into the editor. He demonstrated a bunch of things that the TypeScript compiler can do for us — even if we are not even writing TypeScript! Two of the main features, that might make TypeScript appealing even to opponents of strongly typed languages are:</p><ol><li>A strong focus on type inference, so that we don’t have to be overly verbose with our type annotations, and</li><li>structural typing, which basically means that the compiler will happily duck-type objects that are nominally of different types, but structurally compatible — that kind of flexibility is, afterall, why we enjoy writing JavaScript so much, isn’t it?</li></ol><h3>Technologies of Tomorrow?</h3><p>TypeScript is neat and all, but what is even better are fast websites! And a technology that promises to make the web faster is HTTP/2. But much to Tara Z. Manicsic’s (<a href="http://twitter.com/tzmanics">@tzmanics</a>) dismay, developers don’t seem to appreciate this new standard. Tara tried to take our fear by explaining how the implementations of HTTP/2 have matured since its initial standardization… and in which aspects they haven’t.</p><p>Maybe we software developers are just not enough server-admin types to figure this stuff out. We want nitty-gritty programming language features like top-level await. A moderately big question mark since the introduction of async/await in JavaScript has been, how that feature could ever play nice with the module system. Gladly for us, Myles Borins (<a href="http://twitter.com/MylesBorins">@MylesBorins</a>) is on the case and involved in the standardization of top-level await by TC39. He talked about the status of the proposal and explained the different semantics that are possible to resolve dependencies involving async modules.</p><h3>It’s the little things</h3><p>The regular speaking sessions were loosened up by slots for lightning talks. And while I don’t want to make this article even longer than it already is, I <em>have</em> to mention the high-quality talks featuring:</p><ul><li>Jeremias Menichelli (<a href="http://twitter.com/jeremenichelli">@jeremenichelli</a>) about asynchronously loading webfonts,</li><li>Tim Pietrusky (@TimPietrusky) about using WebUSB to talk to an Arduino,</li><li>Roy Derks (<a href="http://twitter.com/gethackteam">@gethackteam</a>) about the downsides to boilerplate,</li><li>Sam Wray (<a href="http://twitter.com/_2xAA">@_2xAA</a>) about better render performance with off-screen canvas,</li><li>Adam Weeks (<a href="http://twitter.com/AdamWeeks">@AdamWeeks</a>) about debugging JavaScript code,</li><li>Mael Nison (<a href="http://twitter.com/arcanis">@arcanis</a>) about Yarn and locating modules,</li><li>Kashyap Kondamudi (<a href="http://twitter.com/kgrz">@kgrz</a>) about composing promises,</li><li>Tejas Kumar (<a href="http://twitter.com/_TejasKumar">@_TejasKumar</a>) about WebAssembly,</li><li>Olivier Loverde (<a href="http://twitter.com/loverdeolivier">@loverdeolivier</a>) about the CQRS pattern, and finally</li><li>Joost Lubach (<a href="http://twitter.com/joostlubach">@joostlubach</a>) with an <em>incredibly </em>entertaining visualization of asynchronous program execution.</li></ul><p>So shoutout to these guys. And while we’re at it: For this awesome event we have to thank the great team behind it, including Sylvain Zimmer (@sylvinus), Ferdinand Boas (@ferdinandboas), Dorothée Hachez (@doh1313) and Vincent Zimmer (@vinczimmer), and of course the glamorous host Christophe Porteneuve (@porteneuve).</p><h3>JavaScript Everywhere</h3><p>JavaScript on the desktop has a bad rep, according to Felix Rieseberg (<a href="http://twitter.com/felixrieseberg">@felixrieseberg</a>) — and he’s right. A huge number of Electron apps, one more sluggish and memory-hogging than the last, keeps being released. But it doesn’t have to be that way! Felix gave some great tips and tricks as to how we can make our desktop JavaScript code more performant. The caveats he pointed out were to</p><ul><li><em>mind your modules</em>: Think about what the runtime has to load before the UI gets displayed. Do you really need that npm module?</li><li><em>respect the re-renders</em>: When part of your UI state changes, make sure to not repaint other components unnecessarily.</li><li><em>leverage lifecycle methods</em>: Use a component’s lifecycle methods to your advantage by properly registering — and even more importantly — <br>de-registering callbacks.</li></ul><p>If you do it right, your users won’t even notice that an application uses JavaScript. After all, nobody complained about the JavaScript in Battlefield One, although the ingame UI is rendered via React!</p><p>Speaking of games: Tobias Ahlin (<a href="http://twitter.com/tobiasahlin">@tobiasahlin</a>) from Mojang, the creators of Minecraft, shared interesting insights into their current efforts to create the future Minecraft UI using JavaScript. They use an <a href="https://coherent-labs.com/hummingbird/">optimized JS engine</a> that runs on virtually all platforms to interpret their code, so that they can deliver a performant result on all the devices that run Minecraft today. The new UI is not yet publicly released and still a work-in-progress, but according to Tobias, the convenient tooling and workflows that JS developers are used to, were a welcome surprise for the game devs. They are now able to iterate over new ideas faster — and to tap into the market of millions of JavaScript developers when it comes to hiring.</p><p>Ok, apparently you can build AAA games using JavaScript. But surely JavaScript has its limits and you couldn’t use it for, say, high-performance use-cases like a CDN. Well, yes you can. Or at least, Kurt Mackey (<a href="http://twitter.com/mrkurt">@mrkurt</a>) can. He is tweaking the V8 engine itself to get the performance necessary, that let’s his users define rules for his CDN <a href="https://fly.io/">fly.io</a> using JavaScript. This enables them to easily provide functionality on top of their application, that they can deliver as close to their customers as possible.</p><p>We write a lot of JavaScript code for the web, the desktop or for mobile. But JavaScript is truly everywhere!</p><p>And if you want to give yourself the special treat and let your robots dance to the beat of some music, you better ask Devon Lindsay (<a href="http://twitter.com/devonbl">@devonbl</a>). She not only defined dance-routines for their robot squad, but figured out how to push these routines to the bots over Bluetooth. And while JavaScript is not particularly known for its applications in real-time scenarios, the three little robots performing a choreography in sync — of course live in front of the dotJS audience — showed us: It works!</p><p>Speaking of “it works”: I gotta get back to it, so thanks for reading and happy coding!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zJS7PhQrq3dC3POBg98VFw.jpeg" /><figcaption>For sure!</figcaption></figure><p>PS: Check out <a href="https://www.flickr.com/photos/97226415@N08/sets/72157703590355895/">the official photo gallery</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7f860a33780" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/dotjs-2018-retrospective-c7f860a33780">dotJS 2018 — Retrospective</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why React Native? — Mobile App Development Part 0]]></title>
            <link>https://medium.com/enpit-developer-blog/why-react-native-mobile-app-development-part-0-b2b6e38b67a6?source=rss-be3022822e66------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2b6e38b67a6</guid>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <dc:creator><![CDATA[Peter Steinberg]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 15:39:59 GMT</pubDate>
            <atom:updated>2018-11-28T10:47:59.803Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why React Native? — Mobile App Development Part 0</h3><p><em>This is part 0 in a series of articles about mobile app development with React Native.</em></p><p>This series of blog posts is about developing mobile applications with React Native. But before we get our hands dirty in Part 1, we should justify, why we even consider React Native and what other options there are. If that is not interesting to you, feel free to skip right ahead to Part 1.</p><p>Before we get into actually developing a mobile app using React Native, let us look at the competition and evaluate whether React Native is right for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YU9cLepGCdeX7PAJATKnYw.png" /></figure><h3>The AlterNatives</h3><p>To decide on whether React Native is right for you, you need to know what other choices you have. The alternative technologies that we will consider here, are native development, Apache Cordova, the Ionic framework, Flutter and Xamarin. Maybe one of these approaches is the right one for you because of your technological background or an existing codebase in your company.</p><h4>Native</h4><p>You probably know that you can write your native apps in Java or <a href="http://kotlinlang.org/">Kotlin </a>for Android and in Objective-C or <a href="https://swift.org/">Swift </a>for iOS. For both platforms the native APIs and workflows are simply more powerful and flexible than any cross-platform technology can ever be.</p><p>They allow you to take advantage of all the platform’s features. With cross-platform solutions you eventually will run into a problem that you cannot solve with the given technology — the power of native is endless. Not only are the technical capabilities of native superior, but the documentation is too. Google and Apple have invested into documentation and community for years and whatever problem you are facing, someone has probably already solved it. This is in particularly stark contrast to the React Native ecosystem, which is relatively young and defined by breaking changes in the library or the tooling around it.</p><p>The obvious disadvantage of native development is that you have to develop two apps in parallel: one for iOS and one for Android (unless you decide to only target one of these platforms). This not only adds huge amount of additional coding work, but also introduces an organizational overhead into your development process.</p><p>While it might be a natural thing for a seasoned Java developer to start developing Android apps, web developers will likely have a much harder time transitioning into native app development. For them, using a technology like Cordova or React Native will be much easier to pick up.</p><h4>Cordova</h4><p>Being around since 2011 as the open-sourced version of Adobe’s Phonegap, <a href="https://cordova.apache.org/">Apache Cordova</a> is a classic in the realm of cross-platform mobile development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gcDyAQzCdcs2BJu-5Bd5FQ.png" /><figcaption>Cordova is a mature platform that allows developers to create mobile apps using the technologies of the web.</figcaption></figure><p>Cordova provides you with a web view in which you can run any web application. In order to interact with the platform, Cordova exposes device APIs to the JavaScript inside the web view.</p><p>Running a web application in what is basically a chromeless browser on the mobile device comes with some obvious advantages and disadvantages. It offers you a tremendous amount of freedom when it comes to choosing an application architecture. The hurdle of entry on the one hand and the scalability to support larger applications on the other hand are defined by the framework you use, not by Cordova. Existing web applications might be easily ported over to Cordova and if you want to develop an app for mobile and the web, Cordova is your friend, as it also offers <em>web</em> as a target platform.</p><p>The flexibility of the web-based platform might be scary for developers coming from other languages, but web developers will feel right at home. Since differences in browser engines have become mostly irrelevant, a Cordova based app will likely look exactly the same across iOS and Android. This can be a good thing, if consistency between the apps is a prime concern. But it can also lead to tedious conditional logic if you want to incorporate OS-specific UI concepts and best-practices.</p><p>A downside to rendering a web application instead of using native UI components is, however, that it takes special care to make the UI feel native. There are a lot of details to how native UI looks and feels, that users often only notice unconciously — unless something about UI feels <em>wrong</em>. To avoid irritating users, native behavior has be emulated perfectly. The other option would be, to create a UI that is so radically unique and different from native, that users would not apply their usual expectations for UI to the interaction with your app. If what your app does lends itself well to extremely creative UI concepts, great, but if you mostly rely on traditional ways to display and manipulate data, a web view-based technology such as Cordova might feel clunky.</p><p>Since Cordova does not come with a builtin structure for the user application nor with out-of-the-box UI components, it inspired a host of frameworks that build on top of it. Their scope, approach and success vary, but maybe you find exactly what you are looking for among these frameworks: Besides <a href="https://phonegap.com/">Adobe’s Phonegap</a>, relevant frameworks include <a href="http://framework7.io/">Framework7</a>, <a href="https://onsen.io/">Onsen UI</a> and <a href="https://ionicframework.com/">Ionic</a>.</p><p>Generally speaking, if you are a web developer venturing into mobile for the first time and you are <em>not</em> working with Angular or React already, then Cordova might be right for you, as you can probably take your favorite set of frameworks and libraries that you are using on the web with you.</p><h4>Ionic</h4><p>The <a href="https://ionicframework.com/">Ionic framework</a> builds on top of Cordova, but comes with its own complete ecosystem: It uses Angular as the framework to build the app, brings its own CLI for initializing and packaging projects, has its own marketplace of third-party components that you can use, and they offer a service that lets you build application binaries in the cloud and push updates to clients.</p><p>As Ionic uses the Cordova technology, some of the same pros and cons apply. Given that Ionic is a more complete overall solution and Angular is a relatively rigid framework, it might be a good solution for non-web developers who are looking for a mature system that provides them with a lot of structure to get started quickly. For seasoned Angular developers, choosing Ionic for their first mobile app is probably a no-brainer.</p><p>Web developers who are not fans of opinionated frameworks and like to mix-and-match smaller building blocks to create an architecture to their individual liking might not be too happy about using Angular and I definitely count myself as one of them.</p><h4>Xamarin</h4><p>The Microsoft-owned cross-platform development tool <a href="https://visualstudio.microsoft.com/xamarin/">Xamarin</a> provides you with C#- and .NET wrappers around native APIs. With Xamarin Native you will still end up with native projects for iOS and Android respectively, but a large part of your code will be written in the form of Portable Class Libraries written in C# that you can reuse across platforms.</p><p>Xamarin.Forms is a slightly different solution that has you work on <em>one</em> cross-platform code base. Apart from using C# and .NET for writing application logic, you define your UIs in XAML, a markup language reminiscent of XML that can also be used e.g. in apps for the Universal Windows Platform (UWP). But while you do have one shared codebase for both your iOS and Android, you will nonetheless end up writing a good portion (from what I hear it varies between 5% and 20%) of conditional logic to target each platform specifically.</p><p>Microsoft tries to make up for Xamarin’s relatively small online community by giving you a highly integrated development environment in the form of Visual Studio (which you <em>have</em> to use). The tooling and the SDK allow you to get started quickly with a simple app, but your mileage may vary once you start working on more complex features or those that require platform-specific code.</p><p>Xamarin Native and Xamarin Forms might be worth a look, if you feel at home in the .NET world or even if you are mainly experienced in Java development, as the conceptual leap is smaller compared to e.g. going from Java to React Native. If your company is already invested into the Microsoft ecosystem and you would like your app development to synergize well with other .NET applications your team is working on, Xamarin might be right for you. For people coming from a web development background, such as myself, I see no real benefit in diving into this unfamiliar and only <em>okay</em> environment for doing cross-platform development.</p><h3>Flutter</h3><p>A more recent contender in the realm of cross-platform development, is <a href="https://flutter.io/">Google’s Flutter</a>. It’s an interesting technology in that is bears some similarities with React Native, but differs substantially in other aspects.</p><p>Flutter uses <a href="https://www.dartlang.org/">Google’s Dart programming language</a>. It has been around for a little while but not received much attention from most of the developer community, it seems. It is mainly focused on being used with Flutter to build cross-platform mobile apps, but it can run inside of Chrome and there is a server-side implementation as well. You most likely have not used Dart before and chances are, you are not going to use it for anything in the future — except in Flutter, if that’s your pick.</p><p>Flutter takes quite the opposite approach to running code and native bindings than React Native does: The Dart code is compiled to native ARM code, which beats out React Native and any Cordova-based technology performance-wise. For its UI, though, it does not use bindings for native components, but draws its own UI using a <a href="https://skia.org/">fast and battle-tested rendering library</a>.</p><p>As a consequence, you get visual consistency across different platforms and OS-version (similar to a WebView-based approach), but you potentially lose consistency between the look-and-feel of your app and the OS its running on. Which of these types of consistency is more relevant to you, of course depends on your project.</p><p>In terms of application architecture, Flutter seems to incorporate a paradigm that’s similar to React Native: Data flows down a component hierarchy and state updates have to be manually handled via setState (it even has the same name as in React :) ).</p><p>If you don’t mind learning a new language and like the idea of having your UI consistently rendered across devices, Flutter might be worth a look.</p><p>My personal feeling is, that Flutter takes what makes working with React difficult (data flow and state management), keeps that, and adds a new language to make things more difficult. I thoroughly enjoy writing JavaScript and I am not sold on the benefits of Dart. But I definitely lack the experience here to come to a final judgement about this.</p><h3>React Native</h3><p>While all those technologies have their merits and might be right for your situation, this series is about <a href="https://facebook.github.io/react-native/">React Native</a> after all. So let’s dig into what this is all about!</p><h4>What is it?</h4><p>If you are like me, you want to keep working in JavaScript when it comes to your mobile application, but at the same time not be limited by the technological compromise that is Cordova. Or maybe you just really, really like React. Fret not, my friend: Behold React Native!</p><p>What makes React Native different from Cordova and any derived framework, is that with React Native, <em>your UI is actually a native one</em>. While your general app logic is run by a JavaScript runtime on the mobile device, the UI definitions are mapped to native components. This has the potential to give your app a more native look and feel throughout, not to speak of the better render performance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lGzMClxYxDjw1WGwGHCXBA.png" /><figcaption>At first glance, React Native looks just like React even though it renders a native UI instead of a WebView.</figcaption></figure><p>Developing a React Native app feels very similar to writing a web app in React: You (usually) have your <a href="https://reactjs.org/docs/introducing-jsx.html">JSX</a> component definitions, the same lifecycle methods, you can use <a href="https://redux.js.org/">Redux</a> and <a href="https://www.styled-components.com/">styled-components</a> and all that good stuff that React developers are used to. At the same time, you can use APIs to access device capabilities like the camera or storage.</p><p>The comparison to React.js is also fitting in the sense that the library itself only comes with a view layer (very, very broadly speaking). Developers from other languages might be surprised by the lack of an MVC architecture: For structurally more complex apps you have to find your own solutions (which of course can include using additional JavaScript libraries to help you with that).</p><h4>The Community</h4><p>If you choose to build your app in React Native, you are in good company: Facebook Messenger, Instagram, Pinterest, Skype and Uber all use React Native to some degree. Several posts on large companies’ <a href="https://facebook.github.io/react-native/showcase.html">development blogs</a> reveal how React Native allowed their web developers to create a mobile app and how this app made use of shared components across web and native.</p><p>React Native comes with a couple of useful APIs and components, but quite early in your React Native app development endeavor you will notice that you require features, that the base installation of React Native does not offer. Fortunately there is an enthusiastic and productive community of developers that write and publish custom components, UI toolkits and native modules. Native modules expose some native API to JavaScript so that you can access features like the camera or contact list. A great collection of all kinds of React Native ressources can be found at <a href="http://www.awesome-react-native.com/">awesome-react-native.com</a> and a large set of UI components is assembled in <a href="https://github.com/madhavanmalolan/awesome-reactnative-ui">this GitHub repo</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O5a6o-8R4CaptIyPq2B24w.png" /><figcaption>The awesome-react-native site compiles a large number of useful articles, tutorials and components.</figcaption></figure><h4>Kinda Subjective</h4><p>Why do <em>I</em> think, that React Native is a great choice for mobile app development? It allows me to create native UIs using cross-platform code. How convenient is that?! Neither do I have to write separate applications for each platform, nor do I have to compromise on rendering inside a web view. The power of native is at the fingertips of our JavaScript-proficient hands. And while I personally don’t <em>love</em> writing React, I still like it much better than Angular. React Native allows me to use small libraries and assemble them to my liking using my own glue code and architecture, just like on the web platform. I love JavaScript for its expressive power and with React (Native) I maintain that power to a far higher degree than I would in Angular (or Xamarin for that matter).</p><h3>Summin’ it up</h3><p>You came to this blog post to read about React Native and maybe you are a bit disappointed that we didn’t immediately took a deep dive into the topic. But I think the decision of what technology to employ in a new project, has to be an informed one. Which solution is right for <em>you</em>, depends on your situation:</p><ul><li>What are the technologies that you or your team are most experienced with?</li><li>Can you afford to develop two native apps in parallel?</li><li>How much is your app going to rely on native APIs, how performance-critical is it?</li><li>Do you want to leverage code sharing between the app and the server, or between the mobile app and a web app?</li><li>Should your app adhere strictly to the look-and-feel of the native UI or are you going to build a very custom UI anyway?</li></ul><p>Think about these questions before committing to a technology — what is right for one project is not necessarily right for the next one. I hope, this article could serve as a starting point to guide you in making that decision and to maybe point you into a direction. If you decide to stick with React Native, stay tuned for part 1 of this series, where we will get started with our initial setup of React Native.</p><p>—</p><p>PS: Who said, that the technologies mentioned in this article were mutually exclusive? It is possible to combine them to try and utilize each one’s strengths.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2b6e38b67a6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/enpit-developer-blog/why-react-native-mobile-app-development-part-0-b2b6e38b67a6">Why React Native? — Mobile App Development Part 0</a> was originally published in <a href="https://medium.com/enpit-developer-blog">enpit-developer-blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>