๋ฐ˜์‘ํ˜•

nextjs,tailwindcss,vercel 45

[๋ฆฌ์•กํŠธ, nextJS] state์™€ useSate ๊ฐœ๋…๊ณผ ์‚ฌ์šฉ๋ฒ•

๋ฐ์ดํ„ฐ๋ฅผ ๊ด€๋ฆฌํ•˜๋ ค๋ฉด state์— ๋Œ€ํ•ด ์•Œ์•„์•ผํ•œ๋‹ค. state๋Š” useState() const [likes,setLikes] =useState(0)0์—์„œ ์‹œ์ž‘ํ•œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋ฆฌ์ŠคํŠธ๋ฅผ ๋ฆฌํ„ดํ•œ๋‹ค. ( [likes,setLikes])likes : state๋ณ€์ˆ˜setLikes : function to update it function Likes() {const [likes, setLikes] = useState(0)const handleClick = () => {setClicks(likes+1)}return(Likes: {likes})};  Controlled ์ปดํฌ๋„ŒํŠธ์˜ ๊ฒฝ์šฐ,form์—์„œ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์“ด๋‹ค. const [value,setValue] =useState('') function Controll..

[ react , nextJS ] ๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ - props ์™€ children

๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๊ฐ€์ง„ props, state ๊ฐœ๋…์— ๋Œ€ํ•ด ์•Œ ํ•„์š”๊ฐ€ ์žˆ๋‹ค.  props๋Š” ์ปดํฌ๋„ŒํŠธ ์™ธ๋ถ€์—์„œ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๊ฐ’, ๋ถ€๋ชจ๋กœ๋ถ€ํ„ฐ ์ž์‹์—๊ฒŒ ๋‹จ๋ฐฉํ–ฅ ๋ฐ์ดํ„ฐ ํ๋ฆ„ ๊ตฌ์กฐ๋ฅผ ๊ฐ€์ง„๋‹ค.  ๋ถ€๋ชจ-์ž์‹ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์•„๋‹Œ๋ฐ ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•ด์•ผํ•˜๋Š”๊ฒฝ์šฐ, context๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. props์“ฐ๊ธฐ ์•Š๊ณ ๋„ ์ปดํฌ๋„ŒํŠธ ์‚ฌ์ด์— ๋ฐ์ดํ„ฐ๋ฅผ ์ „๋‹ฌํ•  ์ˆ˜ ์žˆ๋‹ค. state๋Š” ๋‚ด๋ถ€์—์„œ ์ €์žฅํ•˜๋Š” ๋ฐ์ดํ„ฐ์ด๋‹ค. ๋ฐ˜๋“œ์‹œ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ ์ž์‹ ๊ณผ ๊ทธ ํ•˜์œ„์—๋งŒ ์˜ํ–ฅ์„ ๋ฏธ์นœ๋‹ค. const [count, setCount] = useState(0)1. make prop, give it a value 2. Use prop valuefunction Gretting(props){return {props.text}}*props๋Š” ์˜ค๋ธŒ์ ํŠธ์ž„,๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋“ค์—์„œ ๊ฐ’์„..

tailwind css ์—์„œ ์š”์†Œ๋“ค ๋ชจ๋‘ ๊ฐ€์šด๋ฐ ์ •๋ ฌํ•˜๊ธฐ

tailwind css์—์„œ ํ•˜์œ„ ์š”์†Œ๋ฅผ ๊ฐ€์šด๋ฐ๋กœ ์ •๋ ฌํ•˜๋Š” ๋ฐฉ๋ฒ•  ์ตœ๊ทผ ๋ฐฐ๋‹นํˆฌ์ž ๊ณ„์‚ฐ๊ธฐ ์‚ฌ์ดํŠธ ๊ฐœ๋ฐœํ•˜๋Š” ์ค‘์— ๊ฐ€์šด๋ฐ ์ •๋ ฌ์„ ์ž๋™์œผ๋กœ ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๊ถ๊ธˆํ–ˆ๋‹ค. ์•„๋ž˜๋Š” ๋‚ด๊ฐ€ ๊ฐœ๋ฐœํ•œ ๋ฐฐ๋‹นํˆฌ์ž ์‚ฌ์ดํŠธ!https://www.turtleinvest.site/ko ์ƒ์œ„div์— classname์„ ์•„๋ž˜์™€ ๊ฐ™์ด ์ฃผ๊ณ , flex-container items-center justify-center ํ•˜์œ„ ๊ฐ€์šด๋ฐ ์ •๋ ฌํ•  ์š”์†Œ๋“ค์— className = 'text-center" ๋ฅผ ์ฃผ๋ฉด๋œ๋‹คtext-center ์ผ์ผ์ด ํ•˜๋Š” ๋ฐฉ๋ฒ•์ด ๋ฒˆ๊ฑฐ๋กœ์›Œ์„œ ์•„์˜ˆ ์ž๋™ํ™”ํ•  ์ˆ˜ ์žˆ๋Š” ๋ฐฉ์‹์ด ์žˆ๋‚˜ ์ฐพ๋Š”์ค‘ ์“ด ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.  div className="my-3 flex-container items-center justify-center" >  h1 c..

๊ฐ€๋น„์•„์—์„œ ๋„๋ฉ”์ธ ์‚ฌ์„œ google search console ๋“ฑ๋กํ•˜๊ธฐ

์ €๋ฒˆ์—๋Š” ๋„๋ฉ”์ธ ์‚ฌ์„œ vercel ์— ๋“ฑ๋กํ•˜๋Š” ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด ์‚ดํŽด๋ดค๋‹ค. ์ด๋ฒˆ์—๋Š” SEO ์ž‘์—…์„ ํ•ด๋ณผ ๊ฒƒ์ด๋‹ค.  Google Search Console ์— ๋“ฑ๋กํ•˜๊ธฐhttps://search.google.com/search-console Google Search ConsoleSearch Console ๋„๊ตฌ์™€ ๋ณด๊ณ ์„œ๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ์‚ฌ์ดํŠธ์˜ ๊ฒ€์ƒ‰ ํŠธ๋ž˜ํ”ฝ ๋ฐ ์‹ค์ ์„ ์ธก์ •ํ•˜๊ณ , ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋ฉฐ, Google ๊ฒ€์ƒ‰๊ฒฐ๊ณผ์—์„œ ์‚ฌ์ดํŠธ๊ฐ€ ๋‹๋ณด์ด๊ฒŒ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.search.google.com์œผ๋กœ ์ ‘์†ํ•œ๋‹ค.  property๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ์ฐฝ์— ๊ตฌ๋งคํ•œ ๋„๋ฉ”์ธ ์ž…๋ ฅํ•œ๋‹ค. ํ•˜๋‹จ์— ๋‚˜์˜ค๋Š” txt record ๋ฅผ ๋ณต์‚ฌํ•˜๊ณ , ๊ฐ€๋น„์•„๋กœ ์ ‘์†ํ•œ๋‹ค.  https://www.gabia.com/ ์›น์„ ๋„˜์–ด ํด๋ผ์šฐ๋“œ๋กœ. ๊ฐ€๋น„์•„๊ทธ๋ฃน์›จ์–ด๋ถ€ํ„ฐ ๋ฉ€ํ‹ฐํด๋ผ์šฐ๋“œ๊นŒ..

๊ฐ€๋น„์•„์—์„œ ๋„๋ฉ”์ธ ์‚ฌ์„œ vercel์— ์ ์šฉํ•˜๊ธฐ

https://www.gabia.com/ ์›น์„ ๋„˜์–ด ํด๋ผ์šฐ๋“œ๋กœ. ๊ฐ€๋น„์•„๊ทธ๋ฃน์›จ์–ด๋ถ€ํ„ฐ ๋ฉ€ํ‹ฐํด๋ผ์šฐ๋“œ๊นŒ์ง€ ํ•˜๋‚˜์˜ ํด๋ผ์šฐ๋“œ ํ—ˆ๋ธŒwww.gabia.com ๊ตญ๋‚ด์—์„œ๋„ ๋„๋ฉ”์ธ์„ ์‚ด ์ˆ˜ ์žˆ๋Š” ๊ณณ๋“ค์ด ์žˆ๋Š”๋ฐ ์‹œํ—˜์‚ผ์•„ ํ•œ๋ฒˆ ์‚ฌ๋ดค๋‹ค. ์›๋ž˜๋Š” cloudfare์—์„œ ๋„๋ฉ”์ธ์„ ์ƒ€์—ˆ๋Š”๋ฐ vercel์— ํ•˜๋ฉด ์…‹ํŒ…์ด ์กฐ๊ธˆ ๋ฒˆ๊ฑฐ๋กœ์›Œ์„œ ์ •์ฐฉํ•  ๊ณณ์„ ์ฐพ๋Š”์ค‘์ด๋‹ค ์‚ฌ์šฉ๋ฐฉ๋ฒ•์€ ๊ฐ„๋‹จํ•˜๋‹ค๋„๋ฉ”์ธ์„ ์‚ฌ๊ณ ๋‚œ ๋’ค, dns๋ฅผ ๋“ฑ๋กํ•ด์ฃผ๋ฉด ๋œ๋‹ค.  vercel ์—์„œ ๋‚ด ํ”„๋กœ์ ํŠธ์—์„œ ๋„๋ฉ”์ธ์œผ๋กœ ์ด๋™ํ•œ๋‹ค. ๋‚ด๊ฐ€ ๊ตฌ๋งคํ•œ ๋„๋ฉ”์ธ์„ ๋“ฑ๋กํ•ด์ค€๋‹ค 2. ๊ฐ€๋น„์•„์—์„œ DNS๊ด€๋ฆฌ์—์„œ ๋ ˆ์ฝ”๋“œ๋ฅผ ์ˆ˜์ •ํ•œ๋‹ค ์ด๋Ÿฌ๊ณ  ๋ฐ”๋กœ๋˜์ง€๋Š” ์•Š๊ณ  ์กฐ๊ธˆ ๊ธฐ๋‹ค๋ฆฌ๋ฉด ๋œ๋‹ค ์ฒด๊ฐ์ƒ 15๋ถ„ ์ •๋„?๊ตญ๋‚ด์—์„œ ๋„๋ฉ”์ธ ์‚ฌ๋Š” ๊ฒƒ์— ๋Œ€ํ•ด ์กฐ๊ธˆ ์‹œ๊ฐ„๋„ ์˜ค๋ž˜๊ฑธ๋ฆฌ๊ณ  ๋ถˆ์•ˆ์ •ํ•˜๋‹ค๋Š” ๋ง์ด ์žˆ๋Š”๋ฐ ์ผ๋‹จ ์—ฐ๊ฒฐ์€ ๊ดœ์ฐฎ๊ฒŒ ๋œ๋“ฏํ•˜๋‹ค๊ทธ์น˜๋งŒ ๋ถˆ์•ˆํ•œ..

JSX expressions must have one parent element. NextJS ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

NextJS ์—์„œ ํ”„๋ก ํŠธ ๊ฐœ๋ฐœํ•˜๋‹ค๊ฐ€ JSX expressions must have one parent element. ์˜ค๋ฅ˜๊ฐ€ ๋‚˜์˜ฌ๋•Œ๊ฐ€ ์žˆ๋‹ค.  ์ด๋•Œ ํ•ด๋‹น ๋ถ€๋ถ„์„ , ์™€ ๊ฐ™์ด ๊ฐ์‹ธ์ฃผ๋ฉด ํ•ด๊ฒฐ ๊ฐ€๋Šฅํ•˜๋‹ค. ๊ฐ„๋‹จํ•˜๊ฒŒ๋Š” ๋กœ ๊ฐ์‹ธใ…œ๋ฉด ์‰ฝ๊ฒŒ ํ•ด๊ฒฐ ๊ฐ€๋Šฅํ•˜๋‹ค.  ๋งจ๋‚  ๊นŒ๋จน์–ด์„œ ๊ธฐ๋ก!

[ ๋ฆฌ์•กํŠธ ] ์ปดํฌ๋„ŒํŠธ์™€ ์š”์†Œ , props

๋ฆฌ์•กํŠธ ์ปดํฌ๋„ŒํŠธ๋ž€ ๋ฆฌ์•กํŠธ ์š”์†Œ ๋˜๋Š” ๋‹ค๋ฅธ ์ปดํฌ๋„ŒํŠธ๋ฅผ ์กฐํ•ฉํ•œ ๊ฒƒ์ด๋‹คJSX๋กœ ์ž‘์„ฑ๋œ ์ปดํฌ๋„ŒํŠธ๊ฐ€ ๋ผ์šฐ์ €์—์„œ ํ‘œ์‹œ๋  ๋•Œ๊นŒ์ง€์˜ ํ๋ฆ„์„ ์ž ์‹œ ์„ค๋ช…ํ•˜์ž๋ฉด, ๋จผ์ € ์›นํŒฉ ( ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ๋นŒ๋“œ ๋„๊ตฌ, next js ์—์„œ๋Š” SWC ) ์— ์˜ํ•ด ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋กœ ๋ณ€ํ™˜ํ•œ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ•ด์„์ด ๊ฐ€๋Šฅํ•ด์ง„๋‹ค. ์ด๋•Œ ์ปดํฌ๋„ŒํŠธ๋Š” ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ์˜ ๊ฐ์ฒด๋กœ ํ‘œํ˜„๋œ๋‹ค. ๋ณ€ํ™˜๋œ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ๋ฅผ ๋ณด๊ณ  ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ™”๋ฉด์— ํ‘œ์‹œํ•˜๋Š” ๊ฒƒ์ด๋‹ค ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ ์ฝ”๋“œ์—์„œ ํ”„๋ผ์šฐ์ €์˜ ํ‘œ์‹œ ๋‚ด์šฉ์„ ๋ฐ”๊ฟ”์“ธ๋•Œ๋Š” DOM์— ์ ‘๊ทผํ•ด์•ผ ํ•˜๋ฉฐ, ๋จผ์ € ๊ฐ€์ƒ DOM์„ ๊ตฌํ˜„ํ•œ๋‹ค. ๊ฐ€์ƒ DOM๊ณผ ๋น„๊ตํ•ด ์ฐจ์ด๊ฐ€ ์žˆ๋Š” ๋ถ€๋ถ„๋งŒ ์‹ค์ œ DOM ์„ ์—…๋ฐ์ดํŠธ ํ•œ๋‹ค.  ๋ฆฌ์•กํŠธ์š”์†Œ class, onchange ๋Œ€์‹  className, onChange ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. (์นด๋ฉœ์ผ€์ด์Šค)  ์ปดํฌ๋„ŒํŠธ ๋ฆฌ์•กํŠธ..

๋ฆฌ์•กํŠธ / Next.js ๊ธฐ์ดˆ - ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ ์‹œ์ž‘ํ•˜๊ธฐ

Next.js๋Š” ๋ฆฌ์•กํŠธ ๊ธฐ๋ฐ˜ ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ๋ฆฌ์•กํŠธ์— ๋Œ€ํ•ด ์–ด๋Š์ •๋„ ์•Œ๊ณ  ์žˆ์œผ๋ฉด ์ข‹๋‹ค.  ๋กœ์ปฌ์—์„œ ํ”„๋กœ์ ํŠธ ๊ตฌ์ถ•ํ•˜๊ธฐcreate-react-app์„ ์‚ฌ์šฉํ•ด์„œ ์ž๋™์œผ๋กœ ๋นŒ๋“œ ๊ฐ€๋Šฅํ•˜๋‹ค. npx create-react-app@latest react-sample --template typescriptcd react-samplenpm run start ์‹คํ–‰ํ•˜๋ฉด localhost:3000 ์—์„œ ํ™•์ธ ๊ฐ€๋Šฅํ•˜๋‹ค.

ํƒ€์ž…์Šคํฌ๋ฆฝํŠธ ๊ธฐ์ดˆ - ํ•จ์ˆ˜ , ํ•จ์ˆ˜ ํƒ€์ž…

์ธ์ˆ˜์™€ ๋ฐ˜ํ™˜๊ฐ’ ๊ฐ๊ฐ์˜ ํƒ€์ž…์„ ์ง€์ •ํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•จ์ˆ˜์˜ ์ธ์ˆ˜์™€ ๋ฐ˜ํ™˜๊ฐ’ ๋ชจ๋‘ string ์œผ๋กœ ์ •์˜ํ•˜๋Š” ์˜ˆ์‹œ:function sayHello(name : string): string{return `Hello ${name}`}sayHello('Mewo')  optional ๋กœ๋„ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋‹ค. function sayHello(name? : string): string{return `Hello ${name}`}  ํŒŒ๋ผ๋ฏธํ„ฐ(์ธ์ˆ˜)๋ฅผ ์ •์˜ํ•  ๋•Œ ๊ธฐ๋ณธ๊ฐ’๋„ ์ •์˜ํ•  ์ˆ˜ ์žˆ๋‹ค. ํ•จ์ˆ˜ ํ˜ธ์ถœ์‹œ ํ•ด๋‹น ์ธ์ˆ˜๋ฅผ ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด ์ž๋™์œผ๋กœ ๊ธฐ๋ณธ๊ฐ’์ด ์ ์šฉ๋œ๋‹ค. function sayHello(name : string='KIM'): string{return `Hello ${name}`}  ํ™”์‚ดํ‘œ ํ•จ์ˆ˜ (arrow function) ์˜ ..

๋ฐ˜์‘ํ˜•