React Mobile Apps

React Native Logo

The repl.it website and React are one way to create mobile apps.

While making mobile games is cool, it’s not the easiest thing to get started doing. Even just a few years ago, if you wanted to write a mobile app or game you had to

  1. decide which phone operating system you wanted to code for: iOS or Android
  2. download the development tools for the operating system you’re coding for, which you have to pay for in iOS
  3. code your game in the appropriate language for the OS: Objective-C for iOS and Java for Android
  4. deploy it in the appropriate app store

A lot has changed recently and now it’s a lot easier to write mobile applications. Not only are there more languages to choose from for mobile development, Swift for iOS and Kotlin for Android, but now there’s a way to code your apps for both major systems at once: React Native.

React Native is an adaptation of a very popular framework for building websites called React. The basic idea of programming with React is that you can structure your application as a bunch of components that generate, or render, HTML. Using an extension of JavaScript called JSX you can even make your React code look like HTML like this

<div>
 <div class="row">
   <Square class="square" value={buttonVal1} onClick={() => choiceMade(1)}/>
   <Square class="square" value={buttonVal2} onClick={() => choiceMade(2)}/>
 </div>
 
 <p>{playerName}, which will you choose?</p>
</div>

Even without seeing what other code is around this, you might be able to picture what it does: it offers the player, by name, two choices and runs an event handler depending on which choice is made. This shows a mixture of normal HTML elements with user defined components like <Square>, pretty seamlessly integrated. Actual JavaScript code is contained within curly braces.

 

Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year!

Subscribe Today!

Also In The October 2017 Issue

Building and creating your tools with the Minecraft toolbox helps you survive the game.

Sensors give robots the senses humans have.

30+ ideas for all age holiday gifts, from books to apps to board games to VR and more.

There might be a reason that too-real robot and video game character creeps you out.

This programming language uses colors instead of text and punctuation to add and perform other tasks.

Knowing how passwords are cracked can help you create better passwords.

There are a number of strategies teachers (plus parents and students) can take to learn programming.

This project uses conductive thread to create a glove to activates your phone.

Software programming does neat things with language, in this case, mixing capital letters.

This Scratch game has lots of ways you can customize the game play. No cats were harmed in the making of this article either.

Links from the bottom of all the October 2017 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for October 2017.