์น
![[์คํ๋ฅดํ์ฝ๋ฉํด๋ฝ] ๐ป ์น๊ฐ๋ฐ ์ข
ํฉ - 1์ฃผ์ฐจ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FpAYxI%2FbtrDYd0ygcq%2F19shqhztZNjCgllRa7qbm0%2Fimg.jpg)
[์คํ๋ฅดํ์ฝ๋ฉํด๋ฝ] ๐ป ์น๊ฐ๋ฐ ์ข ํฉ - 1์ฃผ์ฐจ
ใ ์คํ๋ฅดํ์ฝ๋ฉํด๋ฝ ์น๊ฐ๋ฐ ์ข ํฉ โ1์ฃผ์ฐจโ ใ [ ์น์ ๋์ ๊ฐ๋ ] - ์นํ์ด์ง๋ ๋จ์ง ์๋ฒ์์ ์ค๋น๋ ๊ฒ์ ๋ฐ์์ ๊ทธ๋ ค์ฃผ๋ ๊ฒ์ด๋ค. - ๋ธ๋ผ์ฐ์ ์ ์ญํ ์ ์์ฒญ์ ๋ณด๋ด๊ณ , ๋ฐ์ HTML ํ์ผ์ ์๊ฐํ ํด์ฃผ๋ ๊ฒ (1) ๋ธ๋ผ์ฐ์ ์ url์ ํตํด API๋ฅผ ํด๋น ์๋ฒ์ ์ ๋ฌ (2) ์๋ฒ๋ ์ ๋ฌ๋ฐ์ API๋ฅผ ํตํด ํด๋นํ๋ HTML/CSS/JS๋ฑ๊ณผ ๊ฐ์ ์ฝ๋๋ฅผ API๋ฅผ ํตํด ๋ธ๋ผ์ฐ์ ๋ก ์ ๋ฌ (3) ๋ธ๋ผ์ฐ์ ๋ ์ ๋ฌ๋ฐ์ ์ฝ๋๊ฐ ๋ด๊ธด API๋ฅผ ํตํด ์ฌ๋์ด ์๋ณํ ์ ์๊ฒ ๊ทธ๋ ค์ค [ ์์ฃผ ์ฐ์ด๋ ๋จ์ถํค ] ์ฝ๋์ ๋ ฌ Windows: Ctrl + Alt + L macOS: option + command + L ๋ค์ฌ์ฐ๊ธฐ Tab ๋ค์ฌ์ฐ๊ธฐ ์ทจ์ : Shift + Tab ์ฃผ์ Windows: Ctrl + / macOS: comm..
![[React JS] ์ํ ์น ์๋น์ค(5)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FkH0eU%2FbtrpgyTVx2M%2FnxSzFZciBvQlfDJN3jDWkk%2Fimg.png)
[React JS] ์ํ ์น ์๋น์ค(5)
์ด๋ฒ ํฌ์คํ ์์๋ ๋ณธ๊ฒฉ์ ์ผ๋ก CSS ํ์ผ ์์ ์ ํ๊ธฐ ์ ์ ์ ์ฒ๋ฆฌ๋ฅผ ํด์ฃผ๊ฒ ์ต๋๋ค. ํ์ฌ ./src ๊ฒฝ๋ก์ ์์นํ ํ์ผ์ index.js, App.js, Moive.js 3๊ฐ์ javascript ํ์ผ์ ๋๋ค. index.js ํ์ผ์ App.js ๋ฆฌ์กํธ component๋ฅผ ์ฐธ์กฐํด React DOM์ ํตํด ๋ ๋๋งํ๊ณ ์ ๋ฐ์ดํธํ๊ณ ์์ต๋๋ค. // src/index.js import React from "react"; import ReactDOM from "react-dom"; import App from "./App"; ReactDOM.render( , document.getElementById("root") ); ๊ทธ๋ฆฌ๊ณ App.js์์๋ Movie.js ํ์ผ์ ์ฐธ์กฐํ์ฌ ๋ฐ๊ณ ์๊ณ ์ํ ์น ์ฌ์ดํธ์์ API ๋ฐ..
[React JS] ์ํ ์น ์๋น์ค(4)
์ด๋ฒ ํฌ์คํ ์์๋ ์ด๋ป๊ฒ javascript์์ API ๋ฐ์ดํฐ๋ค์ ๋ถ๋ฌ์ฌ ์ ์๋์ง ํ์ธํ๊ฒ ์ต๋๋ค. [ Axios ] axios๋ ๋ธ๋ผ์ฐ์ ์ node.js์์ ์ฌ์ฉํ ์ ์๋ Promise ๊ธฐ๋ฐ HTTP ํต์ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ด๋ค. ๋น๋๊ธฐ๋ก HTTP ํต์ ์ ๊ฐ๋ฅํ๊ฒ ํด ์ฃผ๋ฉฐ return์ promise ๊ฐ์ฒด๋ก ํ๊ธฐ ๋๋ฌธ์ response ๋ฐ์ดํฐ๋ฅผ ๋ค๋ฃจ๊ธฐ ์ฝ๋ค. HTTP ์์ฒญ ์ทจ์ ๋ฐ ์์ฒญ๊ณผ ์๋ต์ JSON ํํ๋ก ์๋ ๋ณํํด์ค๋ค. ๋ธ๋ผ์ฐ์ ํธํ์ฑ์ด ๋ฐ์ด๋๋ค. // axios post method axios({ method: 'post', url: '/user/12345', data: { firstName: 'Yongseong', lastName: 'Kim' } }); [ Fetch ] fetch๋ ES6๋ถํฐ j..
![[React JS] ์ํ ์น ์๋น์ค(3)](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FepuF9P%2FbtrpiIutbOu%2F6JAjkFw084Z6d8pvzxCyC0%2Fimg.png)
[React JS] ์ํ ์น ์๋น์ค(3)
์ ๋ฒ ํฌ์คํ ์์ ๊ฐ๋ตํ๊ฒ ์ค๋ช ํ๊ณ ๋์ด๊ฐ ํด๋์คํ component์ ๋ํด์ ์กฐ๊ธ ๋ ๋ค๋ฃจ์ด ๋ณด๊ธฐ๋ก ํฉ์๋ค. [ class component ] class๋ก ์ ์ํ๊ณ render() ํจ์์์ JSX๋ฅผ ๋ฐํํ๋ค. ํจ์ํ component์ ๋ฌ๋ฆฌ state ๊ธฐ๋ฅ ๋ฐ life-cycle ๊ธฐ๋ฅ ์ฌ์ฉ์ด ๊ฐ๋ฅํ๋ค. // class component import React from 'react'; class App extends React.Component { render() { return Hello World!; } } export default App; ํจ์ํ component๊ฐ ์๋ ํด๋์คํ component๋ฅผ ์ฌ์ฉํ๋ ์ด์ ์ค ํ๋๋ state๋ผ๋ ๊ธฐ๋ฅ ๋๋ฌธ์ ๋๋ค. (1) State ๊ธฐ์กด props์ ๋ถ๋ชจ ..
[React JS] ์ํ ์น ์๋น์ค(2)
[ JSX ] ์ด์ react์์ ์๋กญ๊ฒ ๋ฑ์ฅํ ๊ฐ๋ ์ธ JSX๋ฅผ ์์๋ด ์๋ค. JSX๋ JS๋ฅผ ํ์ฅํ ๋ฌธ๋ฒ์ด๋ฉฐ JS์์ HTML๊ณผ JS์ ๋ชจ๋ ๊ธฐ๋ฅ์ ๊ตฌํํ ์ ์์ผ๋ฉฐ, UI๊ฐ ์ค์ ๋ก ์ด๋ป๊ฒ ๋ณด์ผ ์ง๋ฅผ ์ค๋ช ํ๊ณ ์์ต๋๋ค. ๋ํ JSX๋ Babel์ ์ํด์ React.createElement() ํธ์ถ๋ก ์ปดํ์ผ ํฉ๋๋ค. const element = ( Hello, world! ); const element = React.createElement( 'h1', {className: 'greeting'}, 'Hello, world!' ); ์์ ๋ ์์๋ ๋์ผํ ๊ธฐ๋ฅ์ ๊ฐ์ง๋ฉฐ, React.createElement() ์ปดํ์ผ์ ๋ค์๊ณผ ๊ฐ์ js object๋ก ๋ณํฉ๋๋ค. const element = { type: 'h..