본문 바로가기

Category

(329)
[react] 이미지 태그 잘못된 방식 function App() { return (
[react] 라우터 설치 및 적용 설치 yarn add react-router-dom 적용 src/index.js import React from 'react'; import ReactDOM from 'react-dom'; import { BrowserRouter } from 'react-router-dom'; // 여기추가 import './index.css'; import App from './App'; import reportWebVitals from './reportWebVitals'; ReactDOM.render( // 여기추가 , document.getElementById('root') ); reportWebVitals(); BrowserRouter라는 컴포넌트를 사용하여 감싸면 됩니다. 이 컴포넌트는 웹 애플리케이션에 HTM..
[react] 프로젝트 생성 후 내가 하는 것들 순서 yarn create react-app 이름 깃연동 src/components 만들어둠 src/pages만들어둠 src/resources만들어둠 Prettier-Code formatter 설정하기 (링크) 테스트 컴포넌트 만드록 yarn start 돌려보기 이후는 그냥 구현하면서 찾아보면서 코드 짜면서 배우면 됨. 라우터 설정 (링크) yarn add axios
[react] JSX 문법 메모 JSX 일단기본적으로 리액트컴포넌트에서 JSX 문법을 리턴합니다. // error function App() { const name = undefined return name } // ok function App() { const name = undefined; return {name || "react"}; } 조건문 JSX 내부의 자바스크립트 표현식에서 if 문을 사용할수 없습니다. -> 삼항 연산자 사용해야합니다. import React from "react"; function App() { const name = "리액트"; return ( {name === "리액트" ? ( 리액트 입니다! ) : ( 리액트가 아닙니다 )} ); } export default App; 이렇게 하면 됩니다. 리액트가..
[react] 개념설명 리액트 데이터가 변경되면 뷰도 변경을 해줘야합니다. 예를들어 js 변수 age = 20 이면 , HTML에도 나이: 19 19를 20으로 변경을 해줘야했습니다. 페북개발팀에서는 데이터를 HTML에 데이터를 포함하기로 합니다. 그러면 age가 20이 되면 , HTML에도 나이: { age } 따로 변경할 필요가 없어집니다. 리액트개발팀은 데이터가 변할때 마다 전체 기존 뷰를 날려버리고 처음부터 새로 렌더링하는 방식을 사용하려 했지만, DOM 전체를 리렌더링하는것이 너무 느렸습니다.🤨 (만약 input값에 hello 를 입력한다면 h, e, l, l, o 총 5번 이나 전체 DOM이 리렌더링 되기때문) 하지만 리액트는 virtualDOM 을 사용해서 전체 DOM이 5번이나 리렌더링 되지 않고 필요한 부분만 ..
[git] 처음 푸쉬하기 Github 푸쉬하기 깃허브에서 저장소를 생성하면, 몇가지 명령어들을 확인할 수 있습니다. git remote add origin https://github.com/githubid/repositoryname.git git branch -M main git push -u origin main 저는 create react-app 으로 프로젝트를 생성해서 git 이 자동으로 생성되어 git init 을 할 필요가 없었습니다. 위 명령어가 무슨 뜻인지 알아보겠습니다. origin 이라는 이름으로 내 원격저장소 주소를 설정합니다. 내 로컬 브랜치를 --move(-M) 을 이용해 main으로 변경합니다. (Default local branch: master) 근데 사실 이동하는 곳이없으니 이름이 변경됩니다. 원래는..
[GCP공부] Coursera: Google Cloud Platform Fundamentals: Core Infrastructure - Virtual Machines in the Cloud Module Introduction 배울거; How Google Compute Engine works with a focus on Google virtual networking. Virtual Machine 이라고 하는 이유는: 내가 다 구성할수 있기 대문이야 실제 머신처럼. (Power, GPU, Momory, CPu Power.. ) Virtual Private Cloud (VPC) Network VPC Network 기본: You can segment your networks, use firewall rules to restrict access to instances, and create static routes to forward traffic to specific destinations. 구글만..
[GCP공부] Coursera: Google Cloud Platform Fundamentals: Core Infrastructure - Getting Started with Google Cloud Platform Introduction 프로젝트를 조직화하고 관리하기 위해서 Google Cloud Identity and Access Management 를 사용해야 합니다.(IAM, IM) The principle of least privilege is very important This principle says that each user should have only those privileges needed to do their jobs. In a least-privilege environment, people are protected from an entire class of errors. A coworker of mine once accidentally deleted a running production d..