분류 전체보기
-
드롭다운 메뉴프론트엔드/컴포넌트 2024. 5. 31. 09:53
import React, { useState, useEffect, useRef } from 'react'import './App.css'import Dropdown from './Dropdown'const dropdownMenu = { 'Home': ['home-1', 'home-2'], 'About': ['about-1', 'about-2', 'about-3'], 'Contact': ['contact-1']}function App(){ const [page, setPage] = useState('') // 현재 선택한 메뉴 저장 const [layout, setLayout] = useState({}) // 현재 드롭다운 위치 저장 const [target, setTarg..
-
컴포넌트 리렌더링과 state 상태 (.feat 클린업)프론트엔드/프론트엔드 이슈 2024. 5. 29. 16:47
컴포넌트가 리렌더링된다고 해서 state 값이 초기화되는 것이 아니다. 아래와 같은 상황을 생각해보자!import React, { useState, useEffect } from 'react'import './App.css'function App(){ const [weather, setWeather] = useState(null) const [reset, setReset] = useState(true) const handleClick = () => setReset(false) useEffect(() => { console.log("날씨") if(reset){ setWeather("맑음") } // return ()..
-
웹 호스팅하기 (4) - vercel + react + esbuild 배포하기 (2)서비스 배포 2024. 5. 28. 15:04
https://stackoverflow.com/questions/77413274/esbuild-bundle-html-css-js-into-a-single-file `, } ] }) ] }) .then(() => console.log('⚡Bundle build complete ⚡')) .catch(e => { console.log('❌Failed to bundle ❌') console.log(e) process.exit(1..
-
웹호스팅하기 (3) - vercel + react + esbuild 배포하기서비스 배포 2024. 5. 24. 10:37
https://esbuild.github.io/getting-started/#install-esbuild esbuild - Getting Startednpm/pnpm: If you are installing with npm or pnpm, you can try not copying the node_modules directory when you copy the files over, and running npm ci or npm install on the destination platform after the copy. Or you could consider using Yarn instead whichesbuild.github.io * esbuild 란?CRA(create-react-app) 이라는 명령어..
-
웹호스팅하기 (2) - vercel + react 배포하기서비스 배포 2024. 5. 23. 16:04
https://vercel.com/guides/deploying-react-with-vercel How to Create & Deploy a React App to VercelLearn how to create a React app and deploy it live with Vercel in only a few steps.vercel.comhttps://velog.io/@codns1223/Etc-Vercel%EB%A1%9C-React-%ED%94%84%EB%A1%9C%EC%A0%9D%ED%8A%B8-%EB%B0%B0%ED%8F%AC%ED%95%98%EA%B8%B0 [Etc] Vercel로 React 프로젝트 배포하기Vercel은 Next.js 개발 팀에서 만든 프론트엔드 배포 자동화할 수 있게 빌드,배포..
-
웹호스팅하기 (1) - vercel + express.js + mongodb 배포하기서비스 배포 2024. 5. 22. 11:59
https://vercel.com/guides/using-express-with-vercel How to Deploy an Express.js Application to VercelLearn how to deploy an Express.js application to Vercel using Serverless Functions.vercel.com * 프로젝트 초기설정하기 const express = require("express");const app = express();app.get("/", (req, res) => res.send("Express on Vercel"));app.listen(3000, () => console.log("Server ready on port 3000."));module...
-
조건쿼리 (conditional query)백엔드/express.js 2024. 5. 20. 22:29
https://mongoosejs.com/docs/tutorials/query_casting.html Mongoose v8.4.0: Mongoose Tutorials: Query CastingQuery Casting The first parameter to Model.find(), Query#find(), Model.findOne(), etc. is called filter. In older content this parameter is sometimes called query or conditions. For example: const query = Character.find({ name: 'Jean-Luc Picard' }); query.mongoosejs.com * 프론트엔드 조건쿼리 con..
-
API 요청 함수프론트엔드/프론트엔드 이슈 2024. 5. 20. 15:14
async function connectData(url, method, data = null, token = null){ const dataJson = await fetch(url,{ headers:{ 'Content-Type':'application/json', 'Authorization': `${token? 'Bearer' + token : ''}`, }, method: method, body: data? data : null }) const result = await dataJson.json() return result }API 데이터 요청하는 유틸리티 함수입니다. utils 폴더 생성하고, api.js 파일에 작성..