๋ชฉ๋กreact (30)
๐ค ์์งlog ๐ค
๐ก ํผ์์ ๋ง๋ค์ ์๋ค๋ฉด ์ฌ๋ฌ๋ฒ ์ฐ์ตํด๋ณด๊ธฐ ๐ก import { useState, useRef } from 'react' import styled, { css } from 'styled-components' const Todo = () => { const [text, setText] = useState('') const [todoList, setTodoList] = useState([]) const nextId = useRef(1) const handleChange = (e) => { setText(e.target.value) } const handleSubmit = (e) => { e.preventDefault() // form ์์ submit ์ญํ ์ ํ๋ ๋ฒํผ์ ๋๋ ์ด๋ ์๋ก๊ณ ์นจ ๋์ง ์๊ฒ ํ๊ณ ์ถ์ ..
Next JS ์ค์น npm create-next-app . / npm create-next-app —typescript . โ๏ธ * name can no longer contain capital letters ๋ผ๋ ์๋ฌ๊ฐ ๋จ๋ฉด ํด๋๋ช ์ " ๋๋ฌธ์ " ๊ฐ ์์ด์ ๋จ๋๊ฒ์ด๋ฏ๋ก " ์๋ฌธ์ " ๋ก ๋ณ๊ฒฝ Next.. eun-jii.tistory.com .module.css ํ์ผ ์์ฑ CSS ๋ฅผ ์ ์ฉํ ํ์ผ๊ณผ ๊ฐ์ ํด๋์ ํ์ผ๋ช .module.css ํ์ผ ์์ฑ ex) NavBar.js NavBar.module.css .active { color: tomato; } .link { text-decoration: none; } ์ฝ๋๋ฅผ css์ ์ ๊ณ import styles from "./NavBar.module.css";..
์ค์น npx create-next-app@latest . npx create-next-app@latest --ts . โ๏ธ * name can no longer contain capital letters ๋ผ๋ ์๋ฌ๊ฐ ๋จ๋ฉด ํด๋๋ช ์ " ๋๋ฌธ์ " ๊ฐ ์์ด์ ๋จ๋๊ฒ์ด๋ฏ๋ก " ์๋ฌธ์ " ๋ก ๋ณ๊ฒฝ npm run dev ์คํ NextJS ์ React react = library , CSR(client-side-rendering) Nextjs = framework , SSR(server-side-rendering) โ๏ธ CSR : ํด๋ผ์ด์ธํธ ์ฌ์ด๋ ๋ ๋๋ง ์ด๋ ์ฌ์ฉ์์ ์์ฒญ์ ๋ฐ๋ผ ํ์ํ ๋ถ๋ถ๋ง ์๋ต ๋ฐ์ ๋ ๋๋ง ํ๋ ๋ฐฉ์ SSR : ์๋ฒ์ฌ์ด๋ ๋ ๋๋ง์ ์ฝ์๋ก ์๋ฒ๋ก๋ถํฐ ์์ ํ๊ฒ ๋ง๋ค์ด์ง htmlํ์ผ์ ๋ฐ์์ ํ..
Naver ์ํ ๊ฒ์ ๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import Main from './components/pages/Main' import Movie from './components/pages/Movie' import Book from './comp.. eun-jii.tistory.com Naver ์ฑ ๊ฒ์ Naver ์ํ ๊ฒ์ ๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import Main from './components/pages/Main' import Movie from './..
๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import { Login, Main, Signup } from './Components/Pages' const Router = () => { return ( . . ) } export default Router ๐ฃ 2. index.js export { default as Login } from './Login' export { default as Main } from './Main' export { default as Signup } from './Signup' ๐ฃ 2-1. App.js ์ Router โก import import Router from './..
Naver ์ํ ๊ฒ์ ๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import Main from './components/pages/Main' import Movie from './components/pages/Movie' import Book from './comp.. eun-jii.tistory.com ๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import Main from './components/pages/Main' import Movie from './components/pages/Movie'..
๐ฃ 1. Router.js ์์ฑ import { BrowserRouter, Routes, Route } from 'react-router-dom' import Main from './components/pages/Main' import Movie from './components/pages/Movie' import Book from './components/pages/Book' const Router = () => { return ( ) } export default Router ๐ฃ 2. Main.jsx import { Link } from 'react-router-dom' import styled from 'styled-components' const Main = () => { return ( ์ํ ๐ฌ..
๐ฃ 1. Modal Background CSS (๊ธฐ๋ณธ์ ์ธ) import styled from 'styled-components' const Modal = () => { return ( Modal ) } const Backdrop = styled.div` width: 100vw; height: 100vh; position: fixed; top: 0; left: 0; background: rgba(0, 0, 0, 0.7); ` const Container = styled.div` position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #fff; min-width: 300px; border-radius: 4px; `..
๐ฃ 1. Bootstrap.jsx ์ปดํฌ๋ํธ ์์ฑ import Dropdown from './Dropdown' const Bootstrap = () => { return ( ) } export default Bootstrap ๐ฃ 2. Dropdown.jsx ์ปดํฌ๋ํธ ์์ฑ import { useEffect, useState, useRef } from 'react' import styled from 'styled-components' const Dropdown = () => { const [showList, setShowList] = useState(false) const btnEl = useRef(null) useEffect(() => { const onClick = (e) => { if (btnEl.cur..
๐ฃ 1. Bootstrap.jsx ์ปดํฌ๋ํธ ์์ฑ import Accordion from './Accordion' import { accordionData } from '../../datas/bootstrap' const Bootstrap = () => { return ( ) } // ์์ฝ๋์ธ์ปดํฌ๋ํธ๋ฅผ ๋ฐ์ดํฐ๋ง ๊ฐ์๋ผ์ฐ๋ฉด ์์ ๋ด์ฉ์ ๊ต์ฒดํ๋ฉด์ ์ฌํ์ฉ๊ฐ๋ฅ export default Bootstrap ๐ฃ 2. Accordion.jsx ์ปดํฌ๋ํธ ์์ฑ import { useState } from 'react' import styled from 'styled-components' import { ReactComponent as Arrow } from './arrow.svg' const Accordion = ({ ..