- Install the development dependencies
- Install React Native for Desktop
- Running a React Native Windows App
- Links
While React Native is primarily used to build apps for Android and iOS devices, it also supports creating Universal Windows Platform (UWP) apps through React Native for Desktop.
Install the development dependencies
- Enable Developer Mode in Windows Settings App.
- Install the latest verion of Visual Studio 2022 with the following options:
- Workloads
Node.js development
.NET Desktop development
Desktop development with C++
- Include
MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest)
(check under ‘Optional’)
- Include
Universal Windows Platform development
orWindows application development
Include C++ (v143) Universal Windows Platform tools
(check under ‘Optional’)
- Individual Components
- Include
Windows 10 SDK (10.0.19041.0)
- Include
MSVC v143 - VS 2022 C++ ARM64 build tools (Latest)
- Include
- Workloads
- Enable Long Paths in Windows.
- Install the latest version of the .NET 6.0 SDK.
Once you have installed everything, you can run the following command in PowerShell to verify that all mandatory requirements are met:
1 | Set-ExecutionPolicy Unrestricted -Scope Process -Force; |
Install React Native for Desktop
Run @react-native-community/cli init
in the directory where you want to save your project:
1 | npx --yes @react-native-community/cli@latest init <projectName> --version "latest" |
This will create the project in a new subdirectory, then you can navigate into that folder:
1 | cd <projectName> |
Add React Native Windows to your project’s dependencies:
Yarn:
1 | yarn add react-native-windows@^0.76.0 |
or NPM:
1 | npm install --save react-native-windows@^0.76.0 |
Initalize the React Native Windows native code and projects:
1 | npx react-native init-windows --overwrite |
Running a React Native Windows App
Run the following command in your project folder:
1 | npx react-native run-windows |
This will open a new Command Prompt window that looks like this:
If everything runs smoothly, your app will open as well: