๋ฐ์ํ ๐ React15 [React] ๋ฆฌ์กํธ์ Hooks ์์ ๋ก ์ ๋ณตํ๊ธฐ React Hooks functional component์์ state๋ฅผ ๊ฐ์ง ์ ์๊ฒ ๋ง๋ฆ class component, componentdidMount, render() ํ ํ์๊ฐ ์์ -> ํ๋์ funciton ์ด ๋จ ์ด๊ฒ์ ํจ์ํ ํ๋ก๊ทธ๋๋ฐ ์ด๋ผ๋ ๋ป์ด๊ธฐ๋ ํจ! recompose + react = ๋ฆฌ์กํธ ํ ! ๐Class component๋ฅผ ์ด์ฉํ react (๊ธฐ์กด ๋ฐฉ์) ๋ฒํผ ํด๋ฆญ์ count ๊ฐ ํ๋์ฉ ์ฆ๊ฐํ๋ ๊ธฐ๋ฅ import React from "react"; import './App.css'; class App extends React.Component{ state = { count: 0 }; modify = (n) => { const { count } = this.state; // .. 2021. 3. 18. [React ] React Router๋ฅผ ์ด์ฉํ์ฌ component๊ฐ์ props ๋๊ฒจ์ฃผ๊ธฐ ( (Link & props) react ๋ฅผ ์ด์ฉํ์ฌ navigation bar๋ฅผ ๊ฐ๋จํ๊ฒ ๋ง๋ค์ด๋ณด์ navigation bar๋ฅผ ๋ง๋ค์ด๋ณด๋ฉด์ reactd์์๋ ํ์ด์ง ๊ฐ์ data๋ฅผ ์ด๋ป๊ฒ ์ฐ๊ฒฐํ๊ณ ๊ณต์ ํ๋์ง ๊ณต๋ถํด ๋ณผ ๊ฒ์ด๋ค. 1) react-router-dom ์ค์น * npm ์ผ๋ก ์ค์น npm install react-router-dom * yarn ์ผ๋ก ์ค์น yarn add react-router-dom 2) Routes ํด๋ ์์ฑ routes ํด๋์๋ ๋ด๊ฐ ๋ง๋ค๊ณ ์ถ์(์ด๋ํ ) ํ์ด์ง ๊ฐ์๋งํผ ๋ง๋ ๋ค routes์ 3๊ฐ์ ํ์ด์ง ์์ฑ - Home.js : ๋ฉ์ธ ์ํ์ค๋ช (์ํ๋ฅผ ๋ณด์ฌ์ฃผ๋ ํ์ด์ง ) - About.js : ์นํ์ด์ง ์๊ฐ๊ธ (์๊ธฐ์๊ฐ ๋ฃ์ ์์ ) - Datail.js : ์ํ ์์ธ ์ค๋ช (์ํ ํด๋ฆญ์ ์์ธ์ค๋ช ํ.. 2021. 3. 18. [React] ํ๋ก์ ํธ GitHub Pages ๋ฐฐํฌํ๊ธฐ + Axios ๋ฅผํตํด json data ๊ฐ์ ธ์ค๊ธฐ AXIOS fetch์์ ์๋ ์์ layer // asios ์ค์น npm i axios data fetchํ๊ธฐ ๋ณดํต Fetch ๋ฅผ ์ฌ์ฉํ์ฌ data๋ฅผ load ํ๋๋ง asios๋ฅผ ์ฌ์ฉํด๋ณด์ class App extends React.Component{ state={ isLoading: true, movies:[] }; getMovies = async() =>{ const movies = await axios.get("https://yts-proxy.now.sh/list_movies.json"); console.log(movies); }; componentDidMount(){ this.getMovies(); } render(){ const {isLoading} = this.state; return ( {.. 2021. 3. 17. [React] setState and Lifecycle function component //function component function App() { return ( ) ; } return ํ ๊ฐ์ screen ์ ํ์ class component React class component ์์ ๊ฐ์ ธ์จ APP component //App์ react component class App extends React.Component{ render( return () ) ; } React component์์ ํ์ฅํ ๊ฒ๋ค์ screen์ ํ์ react๊ฐ render() ๋ฉ์๋๋ฅผ ์๋์ผ๋ก ์คํ class component๋ฅผ ์ฌ์ฉํ๋ ์ด์ต state : object ,data๋ฅผ ๋ฃ์ ๊ณต๊ฐ์ด ์์ data๋ ํญ์ ๋ณํ๊ธฐ ๋๋ฌธ์ state์ ๊ฐ์ ๊ณต๊ฐ ์ด ํ์ sta.. 2021. 3. 16. [ React ] JSX ์ดํดํ๊ธฐ & Proptypes component HTML ์ ๋ฐํํ๋ ํจ์ component๋ฅผ ์ฌ์ฉํด์ ReactDOM.render( , document.getElementById('root') ); JSX javascrtip ์์ HTML Component๋ฅผ ๋ง๋ค๊ณ ์ด๋ป๊ฒ ์ฌ์ฉํ๋์ง javascript + HTML์ ์กฐํฉ React ์ component ์์ฑ ํ๋ฆ react application์ ์ค์ง ํ๋์ component๋ง rendering ๋ฐ๋ผ์ -> ๋ชจ๋ ๊ฒ์ apapplication(API) ์์ ๋ค์ด๊ฐ์ผํจ ๊ตฌํํ๊ณ ์ถ์ component ํ์ผ๋ค์ ๋ง๋ค์ด API.js์ import ํ๊ณ API.js๋ฅผ index ์ ๋ ๋๋งํ๋ ๋ฐฉ์ REACT์ ์์ฑ์ ์ด์ฉํ์ฌ component ๋ถ๋ฌ์ค๊ธฐ โ ์ ์ ๋ฐ์ดํฐ ์ค์ (์ง์ ๋ฃ์ด์ค ๋ฐ์ด.. 2021. 3. 16. React ๋ฆฌ์กํธ๋, ๋ฆฌ์กํธ ์์ ํ๊ฒฝ ์ค์ ์ฌ๋๋ค์ด ์ข์ํ๊ณ , ์ธ๊ธฐ์๊ณ , ๊ฐํธํ ํ๋ ์์ํฌ! ์๋ฐ์คํฌ๋ฆฝํธ ๊ธฐ๋ฐ์ด๊ธฐ๋๋ฌธ์ ๋ฐฐ์ฐ๋๋ฐ๋ ๋ถ๋ด์ด ์๋ค. ๋ฆฌ์กํธ๋ฅผ ์ตํ๋ณด๊ณ ์ง์ ์ฌ์ฉํด๋ณด๊ธฐ ์ํด ๋ ธ๋ง๋์ฝ๋์ ReactJS ๋ก ์ํ ์น์๋น์ค ๋ง๋ค๊ธฐ๋ฅผ ํด๋ณผ ์์ ! ์ค์~ ์๋ ๋ฆฌ์กํธ๋ฅผ ์น๋ธ๋ผ์ฐ์ ์์ ์คํํ๊ธฐ ์ํด์๋ ๋ธ๋ผ์ฐ์ ๋ ๋ฆฌ์กํธ ์ฝ๋๋ฅผ ์ ๋๋ก ์ดํดํ์ง ๋ชปํ๊ธฐ(?) ๋๋ฌธ์ ์์์ฝ๋๋ก ๋ณ๊ฒฝํด์ผ ํจ webpack , Babel ๋ค์ด๋ก๋ -> ๋ฆฌ์กํธ ์ฝ๋ ์ปดํ์ผ ๊ณผ์ ์ ๊ฑฐ์ณ์ผ ํจ ํ์ง๋ง, create react app ํ๋์ ๋ช ๋ น์ ์คํํด์ React Web App ์ ์คํ 1) createreact app์ ํตํด ๋ฆฌ์กํธ ํ๊ฒฝ ๊ตฌ์ฑ ex) ํ๋จ๊ณ ๋ฐ A ๋๋ ํ ๋ฆฌ์์ ์์ฑ -> movie_app ์ด๋ผ๋ ํ๋ก์ ํธ ํด๋ ์์ฑ //npx create-react-app.. 2021. 3. 16. ์ด์ 1 2 ๋ค์ ๋ฐ์ํ