Creating React-native app with using Expo, language Typescript
Here's a step-by-step guide to creating a React Native app using Expo and TypeScript:
Step 1: Install Expo CLI
bash
npm install -g expo-cli
Step 2: Create a new Expo project
bash
npx create-expo-app my-app --template blank-typescript
This will create a new Expo project with a TypeScript template.
Step 3: Navigate to the project directory
bash
cd my-app
Step 4: Start the development server
bash
npx expo start
This will start the development server and open the Expo DevTools in your default web browser.
Project Structure:
The project structure will look like this:
bash
my-app/
├── App.tsx
├── app.json
├── assets/
├── babel.config.js
├── package.json
├── tsconfig.json
└── ...
App.tsx:
The App.tsx file is the main entry point of your app. It contains the root component of your app.
import React from 'react';
import { Text, View } from 'react-native';
export default function App() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello, world!</Text>
</View>
);
}
Creating React-native app without using Expo, language JavaScript
npx @react-native-community/cli@latest init bio2
npm install
npx react-native run-android
No comments:
Post a Comment