๋ฐ˜์‘ํ˜•

React 58

[React] react-datepicker ํŠน์ •/์ง€๋‚œ ๋‚ ์งœ ์ œ์™ธํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro react-datepicker ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋˜ ๋„์ค‘, ๋๋‚ ์งœ๊ฐ€ ์‹œ์ž‘ ๋‚ ์งœ๋ฅผ ์„ ํƒํ•  ์ˆ˜ ์—†๋„๋ก ๋‚ ์งœ๋ฅผ ์ œ์™ธํ•ด์•ผ ํ–ˆ์Šต๋‹ˆ๋‹ค. How to solve the problem ๊ตฌ๊ธ€๋ง ํ›„ ์•„๋ž˜์™€ ๊ฐ™์€ ๋‹ต๋ณ€์„ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค. DatePicker ์†์„ฑ์˜ minDate๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ œ์™ธํ•  ๋‚ ์งœ๋ฅผ ๋„ฃ์–ด์ฃผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. https://stackoverflow.com/questions/50626937/react-datepicker-exclude-past-dates

Framework/React 2023.01.04

[React] react-datepicker ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ css/style ์ ์šฉ ์•ˆ๋˜๋Š” ์—๋Ÿฌ

Intro react-datepicker ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ์‚ฌ์šฉํ•˜๋˜ ๋„์ค‘ CSS ๊ฐ€ ์ ์šฉ ์•ˆ๋˜๋Š” ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ์ฐธ๊ณ ๋กœ ์ €๋Š” ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ๋„ ์ ์šฉํ•ด์•ผ ํ–ˆ๊ธฐ ๋•Œ๋ฌธ์— ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์„ค์น˜๋Š” ์•„๋ž˜์™€ ๊ฐ™์ด ์ง„ํ–‰ํ•˜์˜€์Šต๋‹ˆ๋‹ค. yarn add react-datepicker yarn add @types/react-datepicker react-datepicker ๊ณต์‹ ํ™ˆํŽ˜์ด์ง€์— ์žˆ๋Š” Default ์˜ˆ์ œ๋ฅผ ์ฝ”๋“œ์— ๋„ฃ์–ด ์‹คํ–‰ํ•˜์ž, css๊ฐ€ ์ „ํ˜€ ์ ์šฉ๋˜์ง€ ์•Š๋Š” ์ƒํƒœ๋กœ ํ™”๋ฉด์— ๋œจ๋”๊ตฐ์š”. () => { const [startDate, setStartDate] = useState(new Date()); return ( setStartDate(date)} /> ); }; Why? ๋ฐ”๋กœ ๊ตฌ๊ธ€๋ง์„ ํ•ด๋ดค์Šต๋‹ˆ๋‹ค. ์ €์™€ ๋น„์Šทํ•œ ์—๋Ÿฌ๋ฅผ ๊ฒช์œผ์‹  ๋ถ„๋“ค..

Framework/React 2023.01.03

[Next.js & React] ์‹œ์ž‘ํ•˜๊ธฐ

์ด ๊ธ€์€ udemy์˜ Next.js & React - ์™„๋ฒฝ ์ •๋ณต ๊ฐ€์ด๋“œ (incl. Two Paths) ๊ฐ•์ขŒ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. 1. Welcome to the Coursel ์‹œ์ž‘ํ•˜๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ๊พธ์ค€ํžˆ ํ™”์ดํŒ… ๐ŸคŸ๐ŸคŸ 2. Next.js๋ž€ ๋ฌด์—‡์ธ๊ฐ€? Next.js๋ฅผ ์™œ ์‚ฌ์šฉํ•˜๋Š” ๊ฑธ๊นŒ? NextJS๋Š” ํ”„๋กœ๋•์…˜์šฉ React ํ”„๋ ˆ์ž„ ์›Œํฌ ์ž…๋‹ˆ๋‹ค. ํฐ ๊ทœ๋ชจ์˜ ํ”„๋กœ๋•์…˜์šฉ React ์•ฑ์„ ์‰ฝ๊ฒŒ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ฃผ๋Š” ๋งŽ์€ ๊ธฐ๋Šฅ์„ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ReactJS๋Š” ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์ถ•์„ ์œ„ํ•œ JS ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์ž…๋‹ˆ๋‹ค. ์ฆ‰ Third Party ํŒจํ‚ค์ง€๋กœ ํ”„๋ก ํŠธ ์—”๋“œ ํ”„๋กœ์ ํŠธ์— ์ถ”๊ฐ€๋˜๋Š” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค. ๊ฒฐ๊ตญ ํด๋ผ์ด์–ธํŠธ ์ธก JavaScript ์ฝ”๋“œ๋ผ๋Š” ์ด์•ผ๊ธฐ ์ž…๋‹ˆ๋‹ค. ์ฃผ๋กœ ์‚ฌ์šฉ์ž ์ธํ„ฐํŽ˜์ด์Šค ๋ถ€๋ถ„์ธ ์ปดํฌ๋„ŒํŠธ,..

Framework/Next.js 2022.11.02

[React ์™„๋ฒฝ ๊ฐ€์ด๋“œ] section 11 : Practice Project: Building a Food Order App

์ด ๊ธ€์€ udemy์˜ React ์™„๋ฒฝ ๊ฐ€์ด๋“œ with Redux, Next.js, TypeScript ๊ฐ•์ขŒ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. 139. ๋ชจ๋“ˆ ์†Œ๊ฐœ ์ง€๋‚œ ์„น์…˜์—์„œ ์ค‘์š”ํ•œ ๋ฆฌ์•กํŠธ ๊ฐœ๋…๋“ค์„ ์‚ดํŽด๋ณด์•˜์Šต๋‹ˆ๋‹ค. useEffect, useContext, useReducer ๋“ฑ๋“ฑ / ์œ„ ๊ฐœ๋…์„ ๋ณต์Šตํ•˜๋ฉด์„œ ๋‹ค์‹œ ์‚ดํŽด๋ณด๋„๋ก ํ•ฉ์‹œ๋‹ค. 140. ์„ค์ • ์‹œ์ž‘ํ•˜๊ธฐ Layout folder : ex. Header UI folder: ex. Input 141. "ํ—ค๋”" ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ header ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ 142. Adding the "Cart" Button Component Cart Button ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ 143. Adding a "Meals" Component Meals ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ 144. Adding I..

[React ์™„๋ฒฝ ๊ฐ€์ด๋“œ] section 10 : ๊ณ ๊ธ‰ ๋ฆฌ๋“€์„œ(Reducer)๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๋ถ€์ž‘์šฉ ์ฒ˜๋ฆฌ & ์ปจํ…์ŠคํŠธ API

์ด ๊ธ€์€ udemy์˜ React ์™„๋ฒฝ ๊ฐ€์ด๋“œ with Redux, Next.js, TypeScript ๊ฐ•์ขŒ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. 117. ๋ชจ๋“ˆ ์†Œ๊ฐœ Effects, ReducersContext Working with (Side) Effects MAnaging more Complex State with Reducers Managing App - Wide or Component - Wide State with Context 118. "Side Effects"์ด๋ž€ ๋ฌด์—‡์ด๋ฉฐ useEffect๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค. Main Job : Render UI & React to User Input Evaluate & Render JSX Manage State & Props React to (User) Events & ..

[React] React.FC ์˜ ์˜๋ฏธ์™€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ด์œ 

Intro React.FC์˜ ์˜๋ฏธ์™€ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” ์ด์œ ์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. type Props = { }; const TestComponent: React.FC = () => { return ( TestComponent ); }; export default TestComponent; ํ˜„์žฌ React typescript๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” ํ”„๋กœ์ ํŠธ์—์„œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. FC๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ๋ง์•„์•ผ ํ•˜๋Š” ์ด์œ  ํ•˜์ง€๋งŒ ๐Ÿคจ React typescript๋Š” ๊ทธ๋‹ค์ง€ ์ข‹์€ ๋ฐฉ๋ฒ•์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๊ทธ์ค‘์—์„œ ๊ฐ€์žฅ ํฐ ์ด์œ ๋Š” props์ด ์•”์‹œ์ ์œผ๋กœ ๋“ค์–ด๊ฐ€ ์žˆ๊ธฐ ๋•Œ๋ฌธ์ž…๋‹ˆ๋‹ค. children์„ ์•”์‹œ์ ์œผ๋กœ ๊ฐ€์ง€๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ œ๋„ค๋ฆญ์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ๋„ค์ž„ ์ŠคํŽ˜์ด์Šค ํŒจํ„ด์„ ์ด์šฉํ•  ๋•Œ ๋” ๋ถˆํŽธํ•ฉ..

Framework/React 2022.10.02

[React] innerHTML & ๋™์ ์œผ๋กœ HTML ์ฝ”๋“œ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•

Intro react ์—์„œ ๋™์ ์œผ๋กœ HTML ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์•Œ์•„๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. ์ด๋ฅผ ์œ„ํ•ด ํ•œ ์˜ˆ์‹œ๋กœ "message" : "No: 1, 2\nHello World!" ํ•ด๋‹น text ์—์„œ \n ๋ฅผ ์‹ค์ œ ํƒœ๊ทธ๋กœ ๋ฐ”๊ฟ”์•ผ ํ•œ๋‹ค๊ณ  ํ•ฉ์‹œ๋‹ค. import "./App.css"; function App() { const message = "No: 1, 2\nHello World!"; return ( {message} ); } export default App; ํ˜„์žฌ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์ถœ๋ ฅ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. How to react ์—์„œ๋Š” ํ…์ŠคํŠธ๋กœ ๋œ HTML ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  ์‹ถ์€ ๊ฒฝ์šฐ์—๋Š” react์˜ ๊ทœ์น™์„ ์‚ฌ์šฉํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. dangerouslySetInnerHTML={{ __html: htmlCode }} ..

Framework/React 2022.10.02

[React] Warning: validateDOMNesting(...): <div> cannot appear as a child of <tbody> ์˜ค๋ฅ˜

Intro ์ „๋‹ฌ๋ฐ›์€ props๋ฅผ map ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•˜์—ฌ table๋ฅผ ๋งŒ๋“ค๋˜ ๋„์ค‘ ๋‹ค์Œ์˜ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•˜์˜€์Šต๋‹ˆ๋‹ค. Warning: validateDOMNesting(...): cannot appear as a child of test test test test test test {props.map((item, index) => { return ( {item} {item} {item} {item} {item} {item} ); })} ์ œ๊ฐ€ ๋ดค์„ ๋•Œ๋Š” ๋ถ„๋ช… ๊ฐ ์ž์‹์— index ๋ผ๋Š” key ๊ฐ’์„ ๋ถ€์—ฌํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ์ƒ๊ฐํ–ˆ๋Š”๋ฐ์š”.. Why? ํ•˜์ง€๋งŒ..์•Œ๊ณ ๋ณด๋‹ˆ ์›์ธ์€ ๋ฐ”๋กœ ์— ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.. key ๊ฐ’์€ root component์— ์ ์šฉ ๋˜๋Š” ๊ฒƒ์ด ์›์น™์ด๊ธฐ ๋•Œ๋ฌธ์ด์ฃ . ํ•˜์ง€๋งŒ ์ €๋Š” OtherComponent ๋ฅผ ํ•จ๊ป˜ ์ž‘์„ฑ..

Framework/React 2022.10.01

[React ์™„๋ฒฝ ๊ฐ€์ด๋“œ] section 9 : ํ”„๋ž˜๊ทธ๋จผํŠธ ์ž‘์—…, Portals & "Refs"

์ด ๊ธ€์€ udemy์˜ React ์™„๋ฒฝ ๊ฐ€์ด๋“œ with Redux, Next.js, TypeScript ๊ฐ•์ขŒ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. 108. ๋ชจ๋“ˆ ์†Œ๊ฐœ JSX Limitations & Fragments Getting a Cleaner DOM with Portals Working with Refs 109. JSX ์ œํ•œ ์‚ฌํ•ญ ๋ฐ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ• ๋ฐ˜ํ™˜ํ•˜๊ฑฐ๋‚˜ ์ƒ์ˆ˜์— ์ €์žฅํ•˜๋Š” ๊ฐ’์€ ํ•˜๋‚˜์—ฌ์•ผ ํ•œ๋‹ค. 1. div tag ์‚ฌ์šฉํ•˜๊ธฐ return ( {error && ( )} Username Age (Years) Add User 2. ๋„ค์ดํ‹ฐ๋ธŒ JS array ์‚ฌ์šฉํ•˜๊ธฐ return [ error && ( ), Username Age (Years) Add User , ]; → ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•  ์ˆ˜ ์žˆ๋Š” ์ด์œ ๋Š” ๋ฆฌ์•กํŠธ JSX ์š”..

[React ์™„๋ฒฝ ๊ฐ€์ด๋“œ] section 8 : ์—ฐ์Šต ํ”„๋กœ์ ํŠธ ์™„๋ฃŒ

์ด ๊ธ€์€ udemy์˜ React ์™„๋ฒฝ ๊ฐ€์ด๋“œ with Redux, Next.js, TypeScript ๊ฐ•์ขŒ๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ์ •๋ฆฌํ•œ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. 97. ๋ชจ๋“ˆ ์†Œ๊ฐœ ์—ฐ์Šต ํ”„๋กœ์ ํŠธ ์‹œ์ž‘ 98. "์‚ฌ์šฉ์ž" ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ Technically, the React import is not required in all React projects as you learned. But you're never wrong with adding it. import React from "react"; 99. ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ "์นด๋“œ" ์ปดํฌ๋„ŒํŠธ ์ถ”๊ฐ€ํ•˜๊ธฐ ๋‘ ๊ฐœ์˜ css ํด๋ž˜์Šค๋ฅผ ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ• import React from "react"; import classes from "./Card.module.css"; const Card = ..

๋ฐ˜์‘ํ˜•