카페검색 본문
카페글 본문
-
타입 스크립트에서 객체 생성하기 2023.10.05해당카페글 미리보기
* 객체 생성 1 const person: { name: string; age: number; } = { name: 'kitae', age: 51, }; console.log(person.name); * 객체 생성 2 (객체 생성시에는 이 표현이 더 좋음) const person = { name: 'kitae', age: 51, }; console.log(person.name);
-
(Book) 화면 구성하기- 5단계 2023.09.24해당카페글 미리보기
id, { method: 'GET', }) .then((res) => res.json()) // 결과를 json으로 변환후 반환 .then((res) => { // 작업 수행 console.log(res); setBook(res); // res를 books에 담음 }); }, []); const changeValue = (e) => { // e.target.name : 이벤트가...
-
Re: 주희님이 부르고 있습니다.."갈매기 쌍쌍' 2023.09.22해당카페글 미리보기
URL_LIST[currentPage]; }; var getCafeApp = function () { try { var cafeApp = mainFrame.contentWindow.CAFEAPP; } catch (e) { console.log(e.name + ': ' + e.message); return null; } if (typeof cafeApp == 'undefined' || typeof cafeApp...
-
(Book) 화면 구성하기- 3단계 2023.09.24해당카페글 미리보기
json; charset=utf-8', }, body: JSON.stringify(book), // JSON.stringify() : JSON 형식으로 변환 }).then((res) => { console.log(res); if (res.status === 201) { // 201 : Created return res.json(); } else { alert('책 등록에 실패하였습니다...
-
Redux 사용하기 2023.09.30해당카페글 미리보기
configureStore({ reducer: { user: user.reducer, stock: stock.reducer, }, }); 2. Cart.js 에서 정보 가져오기 import { useSelector } from 'react-redux'; const Cart = () => { let a = useSelector((state) => { return state}); console.log(a...
-
기본 타입 처리하기 2023.10.05해당카페글 미리보기
- tsc app.ts 로 실행 * app.ts function add(n1: number, n2: number) { return n1 + n2; } const number1 = 5; const number2 = 2.8; const result = add(number1, number2); console.log(result);
-
애니메이션 기능 추가하기 2023.09.30해당카페글 미리보기
4. 원할 때 2번 탈부착 const TabContent = ({tabIndex}) => { let [fade, setFade] = useState(''); useEffect(() => { console.log('컨텐츠가 변경됨'); let timer = setTimeout(() => { setFade('end'); }, 100); return () => { // 컴포넌트가 사라질...
-
(Book) 화면 구성하기- 4단계 2023.09.24해당카페글 미리보기
const Detail = () => { const navigate = useNavigate(); // 페이지 이동 const { id } = useParams(); // 매개변수 받기 console.log('id:' + id); const [book, setBook] = useState({ id: '', title: '', author: '', regTime: '', }); // {} : 빈...
-
(Book) 화면 구성하기- 2단계 2023.09.24해당카페글 미리보기
Home = () => { const [books, setBooks] = useState([]); // 함수 실행시 최초 한번만 실행되는 함수 useEffect(() => { console.log('useEffect'); // 비동기 통신 // fetch('http://localhost/book', { method: 'GET', // GET, POST, PUT, DELETE 사용...
-
React(14) - Bootstrap 연결하기(Navbar와 Link추가) 2023.09.18해당카페글 미리보기
want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals(); * Header.js...