React Native, combined with Expo, provides an easy and efficient way to build mobile applications. While TypeScript is commonly used for type safety, many developers prefer JavaScript for its simplicity and faster setup.
Prerequisites
Before getting started, ensure you have the following installed:
Node.js
npm or yarn ( you will get it along node js)
Expo CLI (for building app for production )
Setting Up the Expo App
The original setup that expo@latest would give you includes file-based routing. To create a new React Native project without TypeScript, run the following command:
npx create-expo-app your-appname --template blank
you can replace your-appname with name of your choice
additionally you need to install some other packages such as expo router
npx expo install expo-router
Once the project is created, navigate to your project directory:
cd your-appname
Project Structure
Your project structure should look like this:
your-appname/ ├── App/ ├── package.json ├── node_modules/ ├── assets/ ├── babel.config.js └── app.json
How to use expo routing
create _layout.js in app folder as
import React from "react";
import { Stack } from "expo-router";
export default function RootLayout() {
return (
<Stack screenOptions={{ headerShown: false }} />
);
}
here context api or redux can be used by wrapping Stack.Conclusion
By following these steps, you have successfully set up a React Native Expo app
without TypeScript. You can now build and expand your app using JavaScript,
React Navigation, and styling libraries like NativeWind.
Comments
Post a Comment