Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[22기] 곽윤정 - 2주차 과제 #13

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,27 @@
# study-frontend
프론트엔드 스터디를 위한 레포지토리입니다.
# 조사해보기

## 리액트는 Client Side Rendering 방식의 웹앱을 위한 UI 라이브러리입니다. Client Side Rendering이란 무엇일까요? 전통적인 SSR 방식의 웹앱과의 차이점은 무엇일까요?

- Client Side Rendering : 처음에 rendering에 필요한 모든 정보를 받아오지 않고, 그때그때 필요한 정보를 요청하여 변화된 부분만 rendering하는 방식을 말한다.
- 서버에서 모든 정보를 rendering하여 클라이언트에 전달하는 SSR과 달리, CSR은 브라우저에서 JS 코드가 실행되고, 실행 과정에서 필요한 데이터를 요청하여 이를 기반으로 rendering이 이루어진다. 유저의 행동에 따라 변화된 부분만 re-rendering이 이루어지기 때문에 SSR보다 빠른 interaction이 가능하다.
- CSR에서는 요청 전까지 body가 비어있기 때문에 Search Engine Optimization이 효율적으로 작동하지 않아 SSR보다 검색 노출 면에서 불리한 점이 있다.

## 앞서 리액트는 상태에 따른 선언적 프로그래밍이 가능하도록 돕도록 한다고 말씀드렸습니다. 선언적 프로그래밍과 명령형 프로그래밍의 차이는 무엇일까요?

- 선언적 프로그래밍 : 무엇을(WHAT) 해야 하는지에 주목하는 프로그래밍 형식. 내부적으로 절차적 알고리즘이 동작하며, 절차적인 명령형 프로그래밍이 추상화되어서 선언적 프로그래밍으로 제공된다.
- 명령형 프로그래밍 : 어떻게(HOW) 해야 하는지에 주목하는 프로그래밍 형식. 어떠한 일을 수행하기 위해서 거쳐야 하는 단계를 상세하게 나열한다.

## 브라우저가 웹 페이지를 표시하는 과정을 단계를 나누어 자세히 설명해주세요.

- HTML 파싱 : HTML 문서를 파싱하여 DOM 트리를 생성한다.
- CSS 파싱 : CSS 문서를 파싱하여 CSSOM 트리를 생성한다.
- 렌더 트리 생성 : 브라우저가 DOM 트리와 CSSOM 트리를 결합하여 렌더 트리를 생성한다. 레이아웃과 페인팅에 필요한 정보를 추출한다.
- 레이아웃 : 렌더 트리 각 요소의 위치, 크기를 계산해 정확한 배치를 수행한다.
- 페인팅 : 렌더링된 요소들을 화면에 그린다.

## 리액트를 사용하는 이유를 조사해주세요.

- Virtual DOM의 사용을 통해 DOM을 업데이트할 때 전체 DOM을 다시 그리는 대신 DOM의 복사본을 Virtual DOM에 저장하고 변화가 필요한 부분만 일부 수정하는 방식을 거친다. 이를 통해 불필요한 화면의 갱신을 최소화하고, 성능을 향상시킬 수 있다.
- 컴포넌트 기반이므로 특정 기능이나 화면을 구현할 때 그 화면을 구성하는 일에만 집중할 수 있게 해준다. 서로 다른 파일을 작업하도록 구성할 수 있으므로 효율적 코드 분리가 가능하다.
- 부모 컴포넌트에서 자식 컴포넌트로 단방향 데이터 전달만 가능하여, 데이터를 쉽게 추적할 수 있다.
- 리액트는 유연성과 호환성이 좋아, 웹 애플리케이션, 모바일 애플리케이션 등 다양한 플랫폼에서 쉽게 재사용할 수 있다.
34 changes: 34 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import js from '@eslint/js'
import globals from 'globals'
import reactHooks from 'eslint-plugin-react-hooks'
import reactRefresh from 'eslint-plugin-react-refresh'

export default [
{ ignores: ['dist'] },
{
files: ['**/*.{js,jsx}'],
languageOptions: {
ecmaVersion: 2020,
globals: globals.browser,
parserOptions: {
ecmaVersion: 'latest',
ecmaFeatures: { jsx: true },
sourceType: 'module',
},
},
extends: ["eslint:recommended", "google"],
plugins: {
'react-hooks': reactHooks,
'react-refresh': reactRefresh,
},
rules: {
...js.configs.recommended.rules,
...reactHooks.configs.recommended.rules,
'no-unused-vars': ['error', { varsIgnorePattern: '^[A-Z_]' }],
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
},
]
16 changes: 16 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading