본문 바로가기
React

node.js 설치 및 react native 사용

by improve 2024. 4. 1.

node.js 설치 

 

Visual studio code  터미널.  ->  컨트롤 + `  

 

 

https://reactnative.dev/docs/environment-setup?package-manager=npm

 

Setting up the development environment · React Native

This page will help you install and build your first React Native app.

reactnative.dev

 

Node.js 의(리엑트) npc 

 

npx create-expo-app AwesomeProject  -> 만들어라

cd AwesomeProject  ->change directory(cd) 만들 폴더로 이동  

npx expo start -> 시작 해라

 

import { StatusBar } from 'expo-status-bar';
import { useState } from 'react';
import { Button, Pressable, StyleSheet, Text, View } from 'react-native';

export default function App() {
const [aa,setAA] = useState("aa");
const doA = () =>{
fetch("http://localhost:3000/api/v1/test")
.then(response => response.json)
.then(data => console.log(data))
}
const doB = ()=>{
setAA("bb");
}
return (
<View style={styles.container}>
<Text>Open up App.js to start working on your app!</Text>
<Text>text</Text>
<StatusBar style="auto" />
<view>
<Text>{aa}</Text>
<Button title='press me' onPress={doB} />
</view>
<Pressable onPress={doA}>
<Text>Press me</Text>
</Pressable>
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});

 

 

하지만 큐알 코드 인식 이 어려운 관계로 

컴퓨터에 안드로이드 스튜디오를 설치 하겠다.

 

 

 https://developer.android.com/studio

Android studio 설치를 한다.

 

 

'React' 카테고리의 다른 글

react 기본 예제 연습  (0) 2024.04.18
create-react-app 해보기  (0) 2024.04.18