* ์ด ๊ธ€์€ ์†Œํ”Œ๋‹˜์˜ `์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์—‘ํŠธ(React) ๊ฐ•์˜ ๋‚ด์šฉ์„ ์ •๋ฆฌํ•œ ๊ฒŒ์‹œ๋ฌผ์ž…๋‹ˆ๋‹ค.

์ฒ˜์Œ ๋งŒ๋‚œ ๋ฆฌ์—‘ํŠธ(React) - ์†Œํ”Œ

๋ฆฌ์—‘ํŠธ ์ฐ๋จน

๋ฐฉํ•™ ๋™์•ˆ PS๋ฅผ ์—ด์‹ฌํžˆ ๋ฐฐ์›Œ๋ณผ ์ƒ๊ฐ์ด์—ˆ์œผ๋‚˜,,, PS๊ฐ€ ํ•˜๊ธฐ ์‹ซ์–ด์กŒ๋‹คโ€ฆ

์˜ˆ์ „์— Django ๋ฐฐ์šธ ๋•Œ, React ํ•˜์‹œ๋Š” ๋ถ„์ด๋ž‘ ํ˜‘์—…ํ•ด์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ํ•ด๋ณธ ์ ์ด ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.

์‚ฌ์‹ค ์ œ๊ฐ€ ์ œ๋Œ€๋กœ ๋ฐฐ์šฐ๊ณ  ์‹ถ์€ ๋ถ€๋ถ„์€ ํ”„๋ก ํŠธ์—”๋“œ๋Š” ์ ˆ๋Œ€ ์•„๋‹™๋‹ˆ๋‹ค.

๋‹ค๋งŒ ์‹ฌ์‹ฌํ•˜๊ธฐ๋„ ํ•˜๊ณ , ๋ญ”๊ฐ€ ์žฌ๋ฏธ์žˆ์–ด ๋ณด์—ฌ์„œ ๊ทธ๋ƒฅ ์ฐ๋จนํ•ด ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค~

Ch 00. JavaScript

์Šคํฌ๋ฆฝํŠธ ์–ธ์–ด - ๋Ÿฐํƒ€์ž„์— ์ฝ”๋“œ๊ฐ€ ํ•ด์„๋˜๊ณ  ์‹คํ–‰๋œ๋‹ค.

์ž๋ฃŒํ˜•(Data Type)

Dynamic Typing(๋™์  ํƒ€์ดํ•‘) ๋ณ€์ˆ˜๋ฅผ ์„ ์–ธํ•  ๋•Œ๊ฐ€ ์•„๋‹ˆ๋ผ ๋ณ€์ˆ˜์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ๋Œ€์ž…๋˜๋Š” ์‹œ์ ์— ์ž๋ฃŒํ˜•์ด ๊ฒฐ์ •๋œ๋‹ค.

์ž๋ฃŒํ˜• ์ข…๋ฅ˜

var name1; 
let name2;

// number ํƒ€์ž…
let n = 1234;

//string ํƒ€์ž…
let s = "Hello!";

// NULL ํƒ€์ž…
let a = null;

// ์•„์ง ์ง€์ •๋˜์ง€ ์•Š์Œ
let u1 = undefined;

// ๋ฐฐ์—ด ํƒ€์ž…
// ๋ฐฐ์—ด์— ๋‹ค์–‘ํ•œ ์ž๋ฃŒํ˜• ํฌํ•จ ๊ฐ€๋Šฅ, ์ธ๋ฑ์Šค ๊ฐ€์ง
let arr = [1,2,3,4, "hi"];

// object ํƒ€์ž…
// key๊ฐ’์€ ๋ฌด์กฐ๊ฑด ๋ฌธ์ž์—ด, ๋‚˜๋จธ์ง€๋Š” ์ƒ๊ด€ ์—†์Œ.
let obj = { a: "apple", b:"banana"};

// ๋“ฑ๋“ฑ์˜ ์ž๋ฃŒํ˜• ์กด์žฌ

JavaScript Operator(์—ฐ์‚ฐ์ž)

Assignment Operator(๋Œ€์ž… ์—ฐ์‚ฐ์ž): = Arithmetic Operators(์‚ฌ์น™ ์—ฐ์‚ฐ): + - * / % ** Equal Operators: == !=

Strict equality operators: === !==

์ฒ˜์Œ ๋ณด๋Š” ์—ฐ์‚ฐ์ž์ž…๋‹ˆ๋‹ค. Strict equality operator๋Š” a===b์ผ ๋•Œ, a์™€ b์˜ ๊ฐ’๊ณผ ์ž๋ฃŒํ˜•์ด ๋ชจ๋‘ ๊ฐ™์•„์•ผ ์ฐธ์ด ๋ฉ๋‹ˆ๋‹ค.

Ch 01, 02. React

์žฅ์ 

  • ๋น ๋ฅธ ๋ Œ๋”๋ง ์†๋„(Vertual DOM) Component-Based :๋ ˆ๊ณ  ๋ธ”๋ก ์กฐํ•ฉํ•˜๋“ฏ ์กฐ๋ฆฝํ•˜๋ฉฐ ๊ฐœ๋ฐœ

  • Reusability(์žฌ์‚ฌ์šฉ์„ฑ) - ํ˜ธํ™˜์„ฑ ๋ฌธ์ œ๋ฅผ ๋‚ฎ์ถ”๊ณ  ์—ฌ๋Ÿฌ ๊ณณ์—์„œ ์ปดํฌ๋„ŒํŠธ ์‚ฌ์šฉ, ๋ชจ๋“ˆ ๊ฐ„ ์˜์กด๋„๊ฐ€ ๋‚ฎ์Œ โ€“> ์œ ์ง€ ๋ณด์ˆ˜ ์šฉ์ด, ๊ฐœ๋ฐœ ์†๋„ ๋น ๋ฆ„

๋‹จ์ 

  • ๋ฐฉ๋Œ€ํ•œ ํ•™์Šต๋Ÿ‰. ๊ธฐ์กด ๋ฐฉ์‹๊ณผ ๋‹ค๋ฅธ UI ๋ฐฉ์‹
  • ๋†’์€ ์ƒํƒœ๊ด€๋ฆฌ ๋ณต์žก๋„(state ๊ด€๋ฆฌ)

Ch03. JSX(A syntax extension to JavaScript)

JSX๋ž€?

JS์˜ ํ™•์žฅํŒ. JS + XML/HTML

const element = <h1>Hello World!</h1>;

-> js์ฝ”๋“œ์™€ html ์ฝ”๋“œ๊ฐ€ ๋ณตํ•ฉ์ ์œผ๋กœ ์‚ฌ์šฉ๋œ ๋ชจ์Šต์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

JSX์˜ ์—ญํ• 

JSX์€ ๋‚ด๋ถ€์ ์œผ๋กœ HTML/XML์„ JS ์ฝ”๋“œ๋กœ ๋ณ€ํ™˜ํ•˜๋Š” ๊ณผ์ •์„ ๊ฑฐ์น˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

์ด ๋ณ€ํ™˜์„ ์‹œ์ผœ์ฃผ๋Š” ๊ฒƒ์ด React์˜ createElement ํ•จ์ˆ˜์ž…๋‹ˆ๋‹ค.

JSX๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ  JS ๋งŒ์œผ๋กœ๋„ ๋™์ผํ•œ ๋‚ด์šฉ์„ ์ฝ”๋”ฉํ•  ์ˆ˜ ์žˆ์ง€๋งŒ HTML/XML ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•จ์œผ๋กœ์„œ ๊ฐ€๋…์„ฑ๊ณผ ๊ฐœ๋ฐœ ์†๋„๋ฅผ ํ–ฅ์ƒ์‹œํ‚ฌ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๊ธฐํƒ€ ์žฅ์ ์œผ๋กœ๋Š”

  • Injection Attacks ๋ฐฉ์–ด
function formatName(user) {
	return user.firstName + ' ' + user.lastName;
}

~

const element = (
	// XML/HTML ์ฝ”๋“œ ์‚ฌ์ด์— ์ค‘๊ด„ํ˜ธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ JS ๋ณ€์ˆ˜๋‚˜ ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
	<h1>Hello, {formatUser(user)}</h1>
)

~

** ์ค‘๊ด„ํ˜ธ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋ฌด์กฐ๊ฑด JS ์ฝ”๋“œ๋กœ ๋“ค์–ด๊ฐ„๋‹ค. **