๋ชฉ๋ก์ ์ฒด ๊ธ (433)
whatisthis?

React.js Day 03 React Hooks + WebPack ๐พ PART 1 220315 [TIL] Today I Learned ๐ฏ React.js - (1) React.js Day 03 React Hooks + WebPack 1 / React Hooks ๋ฆฌ์กํธ์์ ์ถ์ฒํ๋ ๊ฒ = Hooks์ ์ฌ์ฉ. Class Component๋ฅผ ์์ ํ๊ณ , ํจ์ํ ํ๋ก๊ทธ๋๋ฐ์ ์ํ Hooks๋ฅผ ๊ถ๊ณ ํจ. ํด๋์ค ์ปดํฌ๋ํธ class Button extends.. mywebproject.tistory.com * ์ง๊ธ๊น์ง์ ์ฝ๋ ๐ webpack.config.js const path = require("path"); module.exports = { name: "wordrelay-setting", mode: "devel..

React.js Day 03 React Hooks + WebPack 1 / React Hooks ๋ฆฌ์กํธ์์ ์ถ์ฒํ๋ ๊ฒ = Hooks์ ์ฌ์ฉ. Class Component๋ฅผ ์์ ํ๊ณ , ํจ์ํ ํ๋ก๊ทธ๋๋ฐ์ ์ํ Hooks๋ฅผ ๊ถ๊ณ ํจ. ํด๋์ค ์ปดํฌ๋ํธ class Button extends React.Component { // ์๋ต render () { return ( ) } ํจ์ํ ์ปดํฌ๋ํธ const Button = () => { // ์๋ต return } ์๋๋ ํจ์ํ ์ปดํฌ๋ํธ๊ฐ ์์๋๋ฐ, ๊ทธ์ ์๋ state๋ ref ๋ฑ์ ํด๋์ค์์๋ง ์ธ ์ ์์๋ค. ๐ก ํจ์ํ์์๋ state๋ ref๋ฅผ ์ธ ์ ์๊ฒ ๋ง๋ ๊ฒ = React Hooks (+ useEffect) useState() React.useState()..

React.js Day 02 (=๋น ํ๊ทธ)์ ์ฌ์ฉ ๋ฆฌ์กํธ์์ ๋จ์ ์ด์๋ ๊ฒ์ด ํญ์ ์ปดํฌ๋ํธ๋ฅผ ๋ก ๊ฐ์ธ์คฌ์ด์ผ ํ๋ค. ๊ทธ๋ฌ๋ฉด, reactDOM์ผ๋ก ๋ ๋๋ง ํ์๋ root>div>์ปดํฌ๋ํธ ์ด๋ฐ์์ผ๋ก ์ธ ๋ฐ ์๋ div๊ฐ ์๊ฒจ๋ฒ๋ฆฌ๊ฒ ๋๋ค. ๋ฐ๋ผ์, ์ด๋ฐ ๋จ์ ์ ๊ฐ์ ํ ๊ฒ์ด ๋ฐ๋ก ๋ก ๊ฐ์ธ์ฃผ๋ ๊ฒ. 1. ์ปดํฌ๋ํธ์ render ๋ถ๋ถ return ( ๐ฏ๊ตฌ๊ตฌ๋จ ๊ฒ์๐ฏ ๐ {this.state.first} ๊ณฑํ๊ธฐ {this.state.second} ๋? ์ ๋ ฅ LOG ๐ {this.state.line} {this.state.result} ); 2. ReactDOM์ render ๋ถ๋ถ ReactDOM.render( , document.querySelector("#root") ); ์ด๋ฐ์์ผ๋ก div#root ํ์ div๋ค์ด ..

React.js ์ ์ธํ ์ฝ๋๋ฅผ ์์ธก ๊ฐ๋ฅํ๊ณ ๋๋ฒ๊ทธํ๊ธฐ ์ฝ๊ฒ ๋ง๋ค์ด์ค. ์ปดํฌ๋ํธ ๊ธฐ๋ฐ ๋ค์ํ ํ์์ ๋ฐ์ดํฐ๋ฅผ ์ฑ ์์์ ์์ฝ๊ฒ ์ ๋ฌํ ์ ์๊ณ , DOM๊ณผ๋ ๋ณ๊ฐ๋ก ์ํ๋ฅผ ๊ด๋ฆฌํ ์ ์์. ๐ก ์นํฉ(webpack)์ ๊ธฐ๋ฅ - ์ชผ๊ฐ์ง js ํ์ผ์ html์ด ์คํํ ์ ์๋ ํ๋์ ํ์ผ๋ก ํฉ์ณ์ค๋ค. React ํด๋์ค ์ปดํฌ๋ํธ HTML like-button.js const e = React.createElement; class LikeButton extends React.Component { constructor(props) { super(props); } render() { return e("button", null, "like"); } } ํด๋์คํ ์ปดํฌ๋ํธ - class ํด๋์ค๋ช extends React.Co..

BookStore UI -codepen ๐ KEY POINTS display: flex์ flex-shrink position: absolute FontAwesome ์ฌ์ฉ - ๋ค๋ฅธ ๋ฐฉ๋ฒ! @import url(//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css); .rating > label::before { display: inline-block; font-size: 0.9em; font-family: FontAwesome; content: "\f005"; } transition๊ณผ ๊ฐ์ํด๋์ค overflow overflow์ text-overflow์ ์ฐจ์ด๋? text-overflow: ellipsis ํ ์คํธ๊ฐ ๋์น๋ฉด ellipsis (..

Modal pop-up - without JS ๐ ๊ธฐ๋ณธ ์๋ฆฌ - ์ ํด์ ํด๋น div#popup์ ๊ฐ์ํด๋์ค :target์ ์ค๋ค! - display block๊ณผ none ํ ๊ธ๋๊ฒ - ๋ซ๊ธฐ๋ฒํผ์๋ ๋ก ๋ค์ ๋๋๋ฆฐ๋ค. HTML Open modal ๋ซ๊ธฐ CSS #popup { display: none; } #popup:target { display: block; } ๐ป ์์ฉ ์์ ์ ์๋ฆฌ๋ฅผ ์ด์ฉํด์ ์์ฉ ์์ ๋ฅผ ๋ง๋ค์ด๋ณด์. div#popup์ class๋ ์ถ๊ฐํด์ ์คํ์ผ ํ๋๋ฅผ ๊ฐ์ง๊ณ ์ฌ๋ฌ๊ฐ์ ๋ชจ๋ฌ์ ๋ง๋ค ์ ์๊ฒ. ๋ํ, display: block์ด์๋๊ณ display: flex๋ฅผ ํด์ ๊ฐ์ด๋ฐ์ ๋ ฌ๋ ๋ค์ผ๋ก ํ ์ ์๊ฒ. index.html Open Modal A Open Modal B Open Modal C..

Slide Page - only CSS - without JS - ๐ ์ค์ตํ๋ฉด์ ์๊ฒ๋ ์ ๊ธฐ๋ก ์ฌ์ง๊ป js๋ก ๋ณต์กํ๊ฒ ํ๋ ๋ฐฉ์ ๋์ , js๋ฅผ ํ๋๋ ์์ฐ๊ณ ์ค๋ก์ง css์ :checked ์ ํ์ ๋ง์ผ๋ก ์ฌ๋ผ์ด๋๋ฅผ ๊ตฌํํ ์ ์๋ค๊ณ ํ๋ค. ๐ :checked - CSS ๊ฐ์ํด๋์ค - ์ ํํ๊ฑฐ๋ on ์ํ์ธ radio, checkbox, option์์๋ฅผ ๋ํ๋ __ ๐ CSS sibling element ๊ด๋ จ ๊ฒฐํฉ์ ~ : ์ดํ ํ์ ์์ ๋ค๊ฐ์ด~ ์ ํํ๋ ๋๋. + : ๋ฐ๋ก ๋ค์์ ์์นํ๋ ํ์ ์์๋ง ์ ํ. >> ๋ฐ๋ก ๋ค์ ํ์ ๋ง ํ์ํ๋ฉด + / ๊ทธ ์ธ๊ฐ ํ์ํ๋ฉด ~ ์ฐ๊ธฐ. p ~ span { color: red; }โ ์ด๊ฑด ๋นจ๊ฐ์ด ์๋๋๋ค. ์ฌ๊ธฐ ๋ฌธ๋จ์ด ์์ต๋๋ค. ๊ทธ๋ฆฌ๊ณ ์ฝ๋๋ ์์ต๋๋ค. ์ด์ ๋นจ๊ฐ์ ..

์ฌ๋ผ์ด๋ ํ์ด์ง (2) ํฐ์นํ(๋๋๊ทธ) - ๐ ์ค์ตํ๋ฉด์ ์๊ฒ๋ ์ ๊ธฐ๋ก ๐touch ์ด๋ฒคํธ changedTouches The TouchEvent.changedTouches property is a TouchList object that contains one Touch object for each touch point which contributed to the event. >> ์ฆ, touchList ๊ฐ์ฒด์ด๋ฏ๋ก ์ฒซ๋ฒ์งธ ์์ดํ ์ธ [0]์ ๊ฐ์ ธ์จ๊ฒ. (ํฐ์น๊ฐ ์ฌ๋ฌ๊ตฐ๋ฐ ๋๋ฉด ์ฌ๋ฌ ๊ฐ ์กด์ฌ) +) ๊ทธ ์ธ์๋ TouchEvent.targetTouches TouchEvent.touches ๋ฑ์ ํ๋กํผํฐ๊ฐ ์กด์ฌํจ. ++) ํฐ์น ์ด๋ฒคํธ์๋ (event) touchstart, touchmove, touchend, t..

์ฌ๋ผ์ด๋ ํ์ด์ง (1) ๋ฒํผํ index.html (style ๋ด์ฅ) First Second Third โฌ Left Rightโก app.js // Div ์ฌ์ด์ฆ ๋์ ์กฐ์ const outer = document.querySelector(".outer"); const innerGrp = document.querySelector(".inner-grp"); const inners = document.querySelectorAll(".inner"); let currentIndex = 0; inners.forEach(inner => { inner.style.width = `${outer.clientWidth}px`; console.log(outer.clientWidth); }); innerGrp.style.wid..

Tab Menu - Tab Menu ๋ค์ํ css skill์ ํฐ๋. ๐ ์ค์ตํ๋ฉด์ ์๊ฒ๋ ์ ๊ธฐ๋ก background: -webkit-linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; -webkit-background-clip๊ณผ color ๐บmdn ๋ฌธ์ ์ฐธ๊ณ (-webkit-text-fill-color ์ color์ ์ฐจ์ด๋?) background-clip - CSS: Cascading Style Sheets | MDN CSS background-clip ์์ฑ์ ์์์ ๋ฐฐ๊ฒฝ์ด ํ ๋๋ฆฌ, ์์ชฝ ์ฌ๋ฐฑ, ์ฝํ ์ธ ์์ ์ค ์ด๋๊น์ง ์ฐจ์งํ ์ง ์ง์ ํฉ๋..