DEV Community

Cover image for React Native TypeScript Boilerplate ( 2024 )
Brian jacob
Brian jacob

Posted on • Edited on

React Native TypeScript Boilerplate ( 2024 )

React Native TypeScript Boilerplate 2024 – There are many resources available online for developers looking to use boilerplates to streamline the process of building React Native apps. These boilerplates can come in the form of CLI templates or npm libraries, and some are even based on TypeScript. While it is not common to find React Native boilerplates that are TypeScript-based, there is a demand for these types of tools among developers who prefer to work with TypeScript in their React Native projects. In this article, we will explore the different types of React Native boilerplates and discuss the benefits of using them.

In this article, I will not only discuss the various types of React Native boilerplates, but I will also provide a tutorial on how to use them. I will include links to the libraries and GitHub repositories so you can easily access and implement these tools in your own projects.
react native boilerplate 2024

Best React Native Typescript Boilerplate 2024

TypeScript is a programming language that is based on JavaScript and includes features such as strong typing and object-oriented programming concepts. These features can make it easier for developers to build complex applications, but some people find that the requirement to specify the types of variables and functions can be tedious. Despite this, many developers appreciate the benefits of using TypeScript, such as improved code quality and fewer runtime errors.

Using TypeScript can have several benefits for developers. One of the main features of TypeScript is the requirement to specify the type or interface for every variable or function that is created.

This helps to ensure that the variables and parameters being used are consistent with their declared type, which can improve code quality and reduce the risk of runtime errors. When a different value or parameter is added to a type that has already been declared, TypeScript will check for any discrepancies and throw an error if it detects a problem. Overall, this strict type-checking system helps to ensure that code is more reliable and easier to maintain.

React Native Typescript boilerplate with Redux

TypeScript's strict type-checking system can be helpful in preventing bugs from appearing in the future. Now, let's return to the topic of React Native Boilerplates. I have recently created a Boilerplate for React Native that is based on TypeScript. Like other Boilerplates, this one is very basic and includes the essentials for starting a new React Native project. By using this TypeScript-based Boilerplate as a starting point, you can easily add any necessary libraries as you build your app from scratch. This can save time and effort in the long run, as you won't have to set up a basic Boilerplate from scratch each time you start a new project.

Checklist for React-Native Boilerplate TypeScript

Here I will review it again. What do you need to make a react native boilerplate?

  • Navigation: It serves to navigate between screens. The most popular is react-navigation.
  • State Management: what is popular here is the redux toolkit. You can also use MOBX or Zustand.
  • React hooks: React provides react hooks that make managing the lifecycle easier. For additional hooks in the fetch API, there’s also react-query that you can also use.
  • React Native icon: icon is an essential thing in making an application. Without the icon, the application will feel like a blank newspaper. So I recommend using the react native vector icon, or you can also use your local icon.

Luckily, the React Native Boilerplate I will share with you already covers the basics needed to build a React Native app. The versions of all the libraries are up to date, so you don’t have to worry.

React-Native Typescript boilerplate

Installation and How to Use React Native Typescript boilerplate

In the first step, just run the code below:


 react-native init MyAppName --template @handidev/react-native-typescript-boilerplate

Enter fullscreen mode Exit fullscreen mode

As a note, replace the word MyAppName with the application name you want.

Next, after everything is successful, the next step is to run the React Native application based on the platform you choose.
for the iOS version, run:



yarn ios


Enter fullscreen mode Exit fullscreen mode

For the Android version, run:



yarn android


Enter fullscreen mode Exit fullscreen mode

Yes, it’s that simple. If you have any problems with the installation, don’t hesitate to contact me on Github.

Link to library react-native-typescript-boilerplate NPM: https://www.npmjs.com/package/@handidev/react-native-typescript-boilerplate

Link to react-native typescript boilerplate GitHub repository: https://github.com/handi-dev/react-native-typescript-boilerplate

Possible Error and solutions:

Error /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:283:in find_spec_for_exe: Could not find 'bundler' (2.1.4) required by your /Users/username/DEVELOPER/MyAppName/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run bundle update --bundler.
To install the missing version, run
gem install bundler:2.1.4
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems.rb:302:in activate_bin_path
from /usr/bin/bundle:23:in <main>

✖ Installing Bundler
error Error: Looks like your iOS environment is not properly set. Please go to https://reactnative.dev/docs/next/environment-setup and follow the React Native CLI QuickStart guide for macOS and iOS.

Solution:

follow step below:

  1. brew install rbenv
  2. rbenv install 2.7.5
  3. rbenv local 2.7.5
  4. export PATH="$HOME/.rbenv/shims:$PATH"

source: React Native TypeScript Boilerplate 2023

Top comments (0)