React Native
init
specific version
mobile development
JavaScript

React Native init specific version

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Creating a React Native project with a specific version matters when you need compatibility with an existing codebase, a known dependency set, or a team-standard template. The important detail is that modern setup guidance uses the Community CLI explicitly, while older examples often show react-native init directly, so version pinning should be done in a way that matches the current CLI flow.

Use the Community CLI with an Explicit Version

The safest approach is to pin the CLI package version directly in the command.

bash
npx @react-native-community/cli@latest init MyApp --version 0.74.5

That asks the React Native Community CLI to create a project whose React Native dependency is 0.74.5. Replace the version number with the exact release you want.

If you also need to pin the CLI version itself, use a specific CLI package version rather than latest.

bash
npx @react-native-community/[email protected] init MyApp --version 0.74.5

This gives you tighter reproducibility when you are recreating an older setup.

Why Version Pinning Matters

React Native projects are sensitive to template changes, Gradle settings, CocoaPods expectations, and native dependency compatibility. Initializing with an exact version is useful when:

  • matching a teammate’s existing project
  • reproducing a bug on a known release
  • creating a new app that must use a library supported only on certain React Native versions
  • avoiding an unexpected template change from a newer release

Without pinning, the generated project may use a later version than you intended.

Verify the Result Immediately

After creation, inspect package.json to confirm the installed React Native version.

bash
cd MyApp
cat package.json

You can also verify through the package manager.

bash
npm ls react-native

or:

bash
yarn why react-native

Checking right away is worth doing because version confusion is easier to fix before any native setup or dependency installation work starts.

Understand the Difference Between CLI Version and React Native Version

These are related but not identical.

  • the Community CLI package is the tool you run to generate the app
  • the React Native version is the dependency added to the created project

Most of the time, you care primarily about the React Native version. But if you are reproducing an older environment exactly, pinning both can reduce surprises.

Older Examples Still Exist

Many older blog posts show commands such as:

bash
npx react-native init MyApp --version 0.63.4

That syntax existed in older guidance and may still appear in legacy discussions. When you are working today, be careful not to copy old setup commands blindly into a modern environment without checking whether the current CLI documentation has changed.

Use the Matching Package Manager Workflow

Once the project is initialized, continue setup consistently with the package manager the template expects.

bash
cd MyApp
npm install

or:

bash
yarn install

Then proceed with platform-specific steps such as CocoaPods installation for iOS.

bash
cd ios
pod install

The initialization command is only the first piece of reproducibility. Native dependency installation still needs to match the chosen version.

Common Pitfalls

A common mistake is pinning only the React Native version while assuming the CLI version cannot matter. Another is following an old article that uses outdated initialization syntax without checking current official guidance. Developers also sometimes create the app successfully and then forget to confirm the actual dependency version in package.json. Finally, version pinning helps only if the rest of the native toolchain, such as Xcode, Android Gradle settings, and CocoaPods, is also compatible with that release.

Summary

  • Initialize with the Community CLI and pass the desired React Native version explicitly.
  • Pin the CLI version too if you need a highly reproducible setup.
  • Verify the created project’s react-native dependency immediately.
  • Be cautious with older react-native init examples from legacy blog posts.
  • Reproducibility depends on both the generated template and the surrounding native toolchain.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.