inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

묻고 답해요

173만명의 커뮤니티!! 함께 토론해봐요.

포괄적 에러 핸들링 error.tsx이 정상 작동 하지 않습니다 (05:30)

해결됨

한 입 크기로 잘라먹는 Next.js

안녕하세요 서버는 종료한 상태에서 강의대로 (with-searchbar)/error.tsx 파일을 만들고 새로고침을 하면 error.tsx에서 작성한 페이지가 나오지 않습니다. error.tsx 인덱스 페이지 아래 사진처럼 error.tsx페이지가 아닌 핸들링되지 않은 런타임 에러가 발생해버립니다.. 혹시 searchParams를 Promise객체로 타입정의 한것처럼 뭔가 사용방법이 바뀐걸까요..?

  • react
  • typescript
  • next.js
  • error.tsx
김동환 댓글 2 좋아요 3 조회수 475

코드리뷰 부탁드립니다.

미해결

자바스크립트 알고리즘 문제풀이 입문(코딩테스트 대비)

Map과 for문으로 풀이를 했는데, 코드리뷰 부탁드립니다. function solution(arr) { let sumSet = new Map(); for (let i = 0; i < arr.length; i++) { let sum = 0; for (let j = 0; j < String(arr[i]).length; j++) { sum += Number(String(arr[i])[j]); } sumSet.set(arr[i], sum); } let maxVal = 0; let maxKey = 0; for (const [key, value] of sumSet) { if (value > maxVal) { maxKey = key; maxVal = value; } else if (value === maxVal) { if (key > maxKey) { maxKey = key; maxVal = value; } } } return maxVal; } console.log(solution([128, 460, 603, 40, 521, 137, 123]));

  • javascript
  • 코딩-테스트
은우 댓글 1 좋아요 0 조회수 162

skeleton UI 적용 시점

해결됨

한 입 크기로 잘라먹는 Next.js

안녕하세요 현재 6.4)스켈레톤 UI 적용하기 강의를 듣고나서 궁금한점이 있어 질문 남깁니다. 서버쪽 데이터요청이 오래 걸리는 경우 Suspense를 통해 Skeleton UI를 보여주고 이후 데이터가 적용 된 컴포넌트를 보여주는거로 알고 있습니다. 그래서 사용자경험이 조금 오를 것 같긴한데, 만약 데이터 요청이 빠른 경우(0.5초만에 데이터처리가 이뤄진 경우)에는 오히려 UX 관점에서 불편하지 않을까 싶어서 이럴땐 어떻게 처리하는게 좋을 지 질문 남깁니다! 예시) 책 검색 -> 책 리스트의 skeleton UI 가 잠깐 보였다가(0.5초 등장) -> 책 리스트 나타남 (이와 같은 과정이 이뤄지면 오히려 사용자 경험이 떨어지지 않을까 싶어 궁금합니다)

  • react
  • typescript
  • next.js
leekyungmin 댓글 1 좋아요 1 조회수 328

2-16 ssg 구현중 에러입니다.

해결됨

한 입 크기로 잘라먹는 Next.js

안녕하세요 강사님, 강의를 듣는 중 문제가 발생해 글 남깁니다. book/id 상세페이지에서 SSG getStaticPaths를 적용중인데, id를 인식을 못해 에러가 발생합니다. Error: A required parameter (id) was not provided as an array received string in getStaticPaths for /book/[[...id]] 강의에 의하면, books/1 은 보여야 하는데 페이지가 보이지 않네요 오타인 것 같아 강사님 깃헙 코드도 복사해서 붙여봤는데 에러가 납니다 혹시 다른 문제가 있을까요? 에러 메세지에는 id가 제공이 안된다고 하는데, 제가 보기에는 staticProps에 맞게 변경한거 같은데, 왜 에러가 날까요??

  • react
  • typescript
  • next.js
나를응원해 댓글 2 좋아요 0 조회수 125

노드(express) 연동

해결됨

React 완벽 마스터: 기초 개념부터 린캔버스 프로젝트까지

유튜브에 올라온 js강의가 너무 만족스러워서 강의를 신청하였고, 현재 강의 잘듣고 있습니다. 저는 노드 공부를 하였고, 프론트 부분을 리액트로 하고 싶어서 강의를 듣고 있는데 혹시 노드(express)와 연동 해서 프로젝트를 하고 싶은데 괜찮은 자료나 강의가 있을까요?

  • react
  • React-Context
  • react-router
  • tailwindcss
  • react-query
철수 댓글 2 좋아요 0 조회수 151

localhost:3000 ERR_CONNECTION_REFUSED

미해결

따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기

npm run dev로 서버는 성공적으로 올라갔는데 localhost:3000 접속 시 연결이 거부되었다고 뜹니다. 이것저것 많이 찾아보긴 했는데 해결이 안되네요 ㅠㅠ windows, 크롬에서 실행했습니다. 해결 방법을 알 수 있을까요? // index.js const express = require("express"); const path = require("path"); const bodyParser = require("body-parser"); const app = express(); const config = require("./server/config/keys"); // const mongoose = require("mongoose"); // mongoose.connect(config.mongoURI, { useNewUrlParser: true, useUnifiedTopology: true }) // .then(() => console.log('MongoDB Connected...')) // .catch(err => console.log(err)); app.use(bodyParser.urlencoded({ extended: true })); app.use(bodyParser.json()); app.use('/api/dialogflow', require('./server/routes/dialogflow')); // Serve static assets if in production if (process.env.NODE_ENV === "production") { // Set static folder app.use(express.static("client/build")); // index.html for all page routes app.get("*", (req, res) => { res.sendFile(path.resolve(__dirname, "client", "build", "index.html")); }); } const port = process.env.PORT || 5000; app.listen(port, () => { console.log(`Server Running at ${port}`) }); //package.json { "name": "chatbot-app", "version": "1.0.0", "description": "chatbot-app", "main": "index.js", "engines": { "node": "18.20.5", "npm": "10.9.0" }, "scripts": { "start": "node index.js", "backend": "nodemon index.js", "frontend": "npm run front --prefix client", "dev": "concurrently \"npm run backend\" \"npm run start --prefix client\"" }, "author": "Jaewon Ahn", "license": "ISC", "dependencies": { "actions-on-google": "^3.0.0", "body-parser": "^1.20.3", "dialogflow": "^1.2.0", "dialogflow-fulfillment": "^0.6.1", "dotenv": "^16.4.5", "express": "^4.21.1", "mongoose": "^8.8.1", "node": "^18.20.5", "punycode": "^2.3.1" }, "devDependencies": { "@ant-design/icons": "^5.5.1", "@babel/plugin-proposal-private-property-in-object": "^7.21.11", "concurrently": "^9.1.0", "nodemon": "^3.1.7" } } client쪽 //package.json { "name": "client", "version": "0.1.0", "private": true, "dependencies": { "antd": "^4.24.16", "axios": "^1.7.7", "prop-types": "^15.8.1", "react": "^18.3.1", "react-dom": "^18.3.1", "react-redux": "^9.1.2", "react-router-dom": "^6.28.0", "react-scripts": "5.0.1", "redux": "^5.0.1", "redux-promise": "^0.6.0", "redux-thunk": "^3.1.0", "uuid": "^11.0.3" }, "scripts": { "start": "react-scripts start", "build": "react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject" }, "eslintConfig": { "extends": "react-app" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "devDependencies": { "http-proxy-middleware": "^3.0.3" } }

  • react
  • node.js
김유림 댓글 1 좋아요 0 조회수 992

Home이 화면에 안 떠요

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

import "./App.css"; import { Routes, Route } from "react-router-dom"; import Home from "./pages/Home"; import Diary from "./pages/Diary"; import New from "./pages/New"; // 1. "/" : 모든 일기를 조회하는 Home 페이지 // 2. "/new" : 새로운 일기를 작성하는 New 페이지 // 3. "/diary" : 일기를 상세히 조회하는 Diary 페이지 function App() { return ( <Routes> <Route path="/" element={<Home />} /> <Route path="/new" element={<New />} /> <Route path="/diary" element={<Diary />} /> </Routes> ); } export default App; const Home = () => { return <div>Home</div>; }; export default Home; 이렇게 작성했고, 오타도 없는 것 같은데 화면에 home이라는 글자가 안 뜹니다. router도 6.28. 으로 설치됐습니다.

  • javascript
  • react
  • node.js
이연서 댓글 1 좋아요 0 조회수 176

API와 DB연결

해결됨

Azure Native로 나만의 GPT 만들기

안녕하세요, API와 DB 연결을 다루는 강의를 시청 중 강의 11분 50초 정도에 웹소켓 연결이 안 되는 문제가 생겨 질문 드립니다! 코드를 전부 똑같이 따라 작성하고 있음에도 왜 localhost 7071로 경로 수정 후 연결이 되지 않는지 모르겠습니다.. 해결 방안이 있을지 여쭙고 싶습니다!

  • javascript
  • python
  • mongodb
  • azure
  • FastAPI
고고링 댓글 2 좋아요 0 조회수 453

cover_image_tag(self) 부분 질문이 있습니다.

미해결

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트 (장고 4.2 기준)

안녕하세요 강사님. 인자로 받는 self는 그 c++의 this 포인터 같은 개념으로 보면 될까요, 그리고 list_display 안에 cover_image를 cover_image_tag로 바꿨는데 처음에 cover_image는 같은 클래스(SongAdmin)에 있는 함수라 list_display에서 사용가능한거고, cover_image_tag는 models 파일 안에 Song 클래스 안에 있는 함수라 list_display에서 사용이 가능한걸까요? 감사합니다.

  • react
  • python
  • django
  • web-api
  • htmx
sunnnwo 댓글 1 좋아요 0 조회수 79

[11-30] 강의 crispy form 적용에서 오류가 발생해서 관련 문의 드립니다.

해결됨

파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트 (장고 4.2 기준)

강사님 안녕하세요, HTMX와 모달을 활용한 댓글 기능을 구현하는 코드 작성 중에 crispy form이 적용이 되지 않고 오류가 발생해서 문의드립니다. 작성하고 있던 코드는 _comment_form.html 파일의 코드입니다 아래 이미지는 발생한 에러 내용입니다. comment_form.html 파일의 코드를 구현하고 로컬호스트에 띄운 개별 Note 페이지의 하단에 '댓글 쓰기' 버튼을 클릭했을 때, crispy form이 렌더링 되지 않고 위와 같은 에러가 발생하는 케이스입니다. 제가 추측하는 것은 context 변수에 담긴 데이터에 문제가 있어서, flatten() 메서드가 동작하지 않아 발생하는 에러 같다고 생각하는데요. 해결하는 방법에 대해 알려주시면 감사하겠습니다! 감사합니다 🙂

  • react
  • python
  • django
  • web-api
  • htmx
천진한 댓글 3 좋아요 0 조회수 160

정렬 연습중인데 왜 여성과 남성 칸이 가로로 배열 안되는지 모르겠습니다.

해결됨

[코드캠프] 시작은 프리캠프

css: * { box-sizing : border-box ; } .box2 { display : flex ; align-items : center ; margin : 10px auto ; flex-direction : column ; justify-content : space-evenly ; } .box { width : 300px ; height : 1px ; border : 1px solid rgb ( 199 , 199 , 199 ); display : flex ; flex-direction : column ; justify-content : space-evenly ; align-items : center ; padding : 30px ; margin : 5px auto ; border-top-left-radius : 10px ; border-top-right-radius : 10px ; border-bottom-right-radius : 10px ; border-bottom-left-radius : 10px ; } .box3 { display : flex ; flex-direction : row ; justify-content : row ; } select { border : 1px solid black ; } .pb { width : 500px ; height : 800px ; border : 1px solid gray ; display : flex ; flex-direction : column ; justify-content : space-around ; align-items : center ; padding : 30px ; border-top-left-radius : 10px ; border-top-right-radius : 10px ; border-bottom-right-radius : 10px ; border-bottom-left-radius : 10px ; } html: <!DOCTYPE html > <html lang = "en" > <head> <title> 회원가입 </title> <link href = "./02-signup.css" rel = "stylesheet" /> </head> <body> <div class = "pb" > <h2 class = "box2" > 회원가입 </h2> <input type = "text" placeholder = "이메일을 입력해주세요" class = "box" ><br><br> <input type = "text" placeholder = "이름을 입력해주세요" class = "box" ><br><br> <input type = "password" placeholder = "비밀번호를 입력해주세요" class = "box" ><br><br> <input type = "password" placeholder = "비밀번호를 다시 입력해주세요" class = "box" ><br><br> <select> <option disabled = "true" selected = "true" > 지역을 선택하세요 </option> <option> 서울 </option> <option> 경기 </option> <option> 인천 </option> </select> <br><br> <input type = "radio" name = "gender" class = "box3" ><span class = "box3" > 여성 </span> <input type = "radio" name = "gender" class = "box3" ><span class = "box3" > 남성 </span> <br><br> <input type = "checkbox" > 이용약관 동의합니다 <hr> <button class = "box" > 가입하기 </button> </div> <!-- <input type="button" value="가입하기2"> 예전에 사용했으나 커스텀하기 어려웠음 --> </body> </html> 어디가 문제 인지 알려주시면 감사하겠습니다.

  • HTML/CSS
  • javascript
웅담 댓글 1 좋아요 0 조회수 153

CORS - Access-Control-Allow-Origin 누락 문제

미해결

Slack 클론 코딩[실시간 채팅 with React]

강좌보면서 proxy 설정하고 back 폴더 npm run dev, alecture 폴더 npm run build 했는데 회원가입 버튼을 누르니 콘솔창에 시간차로 계속 Access to XMLHttpRequest at ' https://sleact.nodebird.com/api/users ' from origin ' http://localhost:3095 ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. app.js:2 GET https://sleact.nodebird.com/api/users net::ERR_FAILED 200 (OK) (익명) @ app.js:2 e.exports @ app.js:2 e.exports @ app.js:2 l.request @ app.js:2 r.forEach.l.<computed> @ app.js:2 (익명) @ app.js:2 r.Z @ 678.js:1 (익명) @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 o @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 D @ app.js:2 [신규] Edge에서 Copilot을 사용하여 콘솔 오류 설명: 클릭 오류를 설명합니다. 자세한 정보 다시 표시 안 함 signup:1 Access to XMLHttpRequest at ' https://sleact.nodebird.com/api/users ' from origin ' http://localhost:3095 ' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. app.js:2 GET https://sleact.nodebird.com/api/users net::ERR_FAILED 200 (OK) (익명) @ app.js:2 e.exports @ app.js:2 e.exports @ app.js:2 l.request @ app.js:2 r.forEach.l.<computed> @ app.js:2 (익명) @ app.js:2 r.Z @ 678.js:1 (익명) @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 o @ app.js:2 (익명) @ app.js:2 setTimeout onErrorRetry @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 u @ app.js:2 Promise.then c @ app.js:2 (익명) @ app.js:2 o @ app.js:2 (익명) @ app.js:2 (익명) @ app.js:2 D @ app.js:2 signup:1 Access to XMLHttpRequest at ' https://sleact.nodebird.com/api/users ' from origin ' http://localhost:3095 ' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. 319.js:1 undefined app.js:2 POST https://sleact.nodebird.com/api/users net::ERR_FAILED라는 오류가 발생합니다. copilot을 실행시켜보니 Access-Control-Allow-Origin과 Origin이 같아야하는데 Access-Control-Allow-Origin 부분이 누락되었다고 나옵니다. 네트워크 200번대는 실행에는 성공한거라고 들었는데... 도움주시면 감사하겠습니다! 제 webpack.config.ts 첨부하겠습니다. import path from 'path'; //import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin'; import webpack, { Configuration as WebpackConfiguration } from "webpack"; import { Configuration as WebpackDevServerConfiguration } from "webpack-dev-server"; //import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'; interface Configuration extends WebpackConfiguration { devServer?: WebpackDevServerConfiguration; } import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin'; const isDevelopment = process.env.NODE_ENV !== 'production'; const config: Configuration = { name: 'sleact', mode: isDevelopment ? 'development' : 'production', devtool: !isDevelopment ? 'hidden-source-map' : 'eval', resolve: { extensions: ['.js', '.jsx', '.ts', '.tsx', '.json'], alias: { '@hooks': path.resolve(__dirname, 'hooks'), '@components': path.resolve(__dirname, 'components'), '@layouts': path.resolve(__dirname, 'layouts'), '@pages': path.resolve(__dirname, 'pages'), '@utils': path.resolve(__dirname, 'utils'), '@typings': path.resolve(__dirname, 'typings'), }, }, entry: { app: './client', }, module: { rules: [ { test: /\.tsx?$/, loader: 'babel-loader', options: { presets: [ [ '@babel/preset-env', { targets: { browsers: ['IE 10'] }, debug: isDevelopment, }, ], '@babel/preset-react', '@babel/preset-typescript', ], env: { development: { plugins: [require.resolve('react-refresh/babel')], }, }, }, exclude: path.join(__dirname, 'node_modules'), }, { test: /\.css?$/, use: ['style-loader', 'css-loader'], }, ], }, plugins: [ // new ForkTsCheckerWebpackPlugin({ // async: false, // // eslint: { // // files: "./src/**/*", // // }, // }), new webpack.EnvironmentPlugin({ NODE_ENV: isDevelopment ? 'development' : 'production' }), ], output: { path: path.join(__dirname, 'dist'), filename: '[name].js', publicPath: '/dist/', }, devServer: { historyApiFallback: true, // react router port: 3090, devMiddleware: { publicPath: '/dist/' }, static: { directory: path.resolve(__dirname) }, proxy: { '/api/': { target: 'http://localhost:3095', changeOrigin: true, }, }, }, }; if (isDevelopment && config.plugins) { // config.plugins.push(new webpack.HotModuleReplacementPlugin()); // // config.plugins.push(new ReactRefreshWebpackPlugin()); // // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'server', openAnalyzer: true })); } if (!isDevelopment && config.plugins) { // config.plugins.push(new webpack.LoaderOptionsPlugin({ minimize: true })); // // config.plugins.push(new BundleAnalyzerPlugin({ analyzerMode: 'static' })); } export default config;

  • react
  • 웹팩
  • typescript
  • socket.io
  • babel
  • 클론코딩
nayoung hwang 댓글 3 좋아요 0 조회수 475

수업 질문입니다.

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

안녕하세요. 해당 강좌로 도움을 많이 받고 있습니다만, 강좌에서는 redux을 이용한 상태관리 없는거 같더구요 . 실무에서 redux를 많이 사용하느것 같은데요, 혹시 추가 적으로 redux 강좌나 추가 업데이트 계획이 있으신지 문의 드립니다. 아님 다른 이정환님의 한입 강좌 중에서 들을 수 있는지요?

  • javascript
  • node.js
babi9005 댓글 2 좋아요 0 조회수 181

12.11 invalid Date 오류

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

따라서 하고 있었는데 다음 그림과 같이 invalid Date 라는 값이 떠서 관련 질문 드립니다. 강의 몇번 돌려보면서 오타가 있나 봤는데 도저히 모르겠어서 질문 드립니다... // App.jsx import "./App.css"; import { Routes, Route, Link, useNavigate } from "react-router-dom"; import Home from "./pages/Home"; import Diary from "./pages/Diary"; import New from "./pages/New"; import Edit from "./pages/Edit"; import Notfound from "./pages/Notfound"; import { useReducer, useRef, createContext } from "react"; const mockData = [ { id: 1, createdDate: new Date("2024-11-13").getTime(), emotionId: 1, content: "1번 일기 내용", }, { id: 2, createdDate: new Date("2024-11-10").getTime(), emotionId: 2, content: "2번 일기 내용", }, { id: 3, createdDate: new Date("2024-10-11").getTime(), emotionId: 3, content: "3번 일기 내용", }, ]; function reducer(state, action) { switch (action.type) { case "CREATE": return [action.data, ...state]; case "UPDATE": return state.map((item) => String(item.id) === String(action.data.id) ? action.date : item ); case "DELETE": return state.filter((item) => String(item.id) !== String(action.id)); default: return state; } } export const DiaryStateContext = createContext(); export const DiaryDispatchContext = createContext(); function App() { const [data, dispatch] = useReducer(reducer, mockData); const idRef = useRef(3); const onCreate = (createdDate, emotionId, content) => { dispatch({ type: "CREATE", data: { id: idRef.current++, createdDate, emotionId, content, }, }); }; const onUpdate = (id, createdDate, emotionId, content) => { dispatch({ type: "UPDATE", data: { id, createdDate, emotionId, content, }, }); }; const onDelete = (id) => { dispatch({ type: "DELETE", id, }); }; return ( <> <DiaryStateContext.Provider value={data}> <DiaryDispatchContext.Provider value={{ onCreate, onDelete, onUpdate }}> <Routes> <Route path="/" element={<Home />} /> <Route path="/new" element={<New />} /> <Route path="/diary/:id" element={<Diary />} /> <Route path="/edit/:id" element={<Edit />} /> <Route path="*" element={<Notfound />} /> </Routes> </DiaryDispatchContext.Provider> </DiaryStateContext.Provider> </> ); } export default App; //Home.jsx import { useState, useContext } from "react"; import { DiaryStateContext } from "../App"; import DiaryList from "../components/DiaryList"; import Header from "../components/Header"; import Button from "../components/button"; const getMonthlyData = (pivotDate, data) => { const beginTime = new Date( pivotDate.getFullYear(), pivotDate.getMonth(), 1, 0, 0, 0 ).getTime(); const endTime = new Date( pivotDate.getFullYear(), pivotDate.getMonth() + 1, 0, 23, 59, 59 ).getTime(); return data.filter( (item) => beginTime <= item.createdDate && item.createdDate <= endTime ); }; const Home = () => { const data = useContext(DiaryStateContext); const [pivotDate, setPivotDate] = useState(new Date()); const monthlyData = getMonthlyData(pivotDate, data); console.log(monthlyData); const onIncreaseMonth = () => { setPivotDate(new Date(pivotDate.getFullYear(), pivotDate.getMonth() + 1)); }; const onDecreaseMonth = () => { setPivotDate(new Date(pivotDate.getFullYear(), pivotDate.getMonth() - 1)); }; return ( <div> <Header title={`${pivotDate.getFullYear()}년 ${pivotDate.getMonth() + 1}월`} leftChild={<Button onClick={onDecreaseMonth} text={"<"} />} rightChild={<Button onClick={onIncreaseMonth} text={">"} />} /> <DiaryList data={monthlyData} /> </div> ); }; export default Home; //diaryList.jsx import Button from "./button"; import "./DiaryList.css"; import DiaryItem from "./DiaryItem"; const DiaryList = ({ data }) => { return ( <div className="DiaryList"> <div className="menu_bar"> <select> <option value={"latest"}>최신순</option> <option value={"oldest"}>오래된 순</option> </select> <Button text={"새 일기 쓰기"} type={"POSITIVE"} /> </div> <div className="list_wrapper"> {data.map((item) => ( <DiaryItem key={item.id} {...item} /> ))} </div> </div> ); }; export default DiaryList; //DiaryItem.jsx import { getEmotionImage } from "../util/get-emotion-image"; import Button from "./button"; import "./DiaryItem.css"; const DiaryItem = (id, emotionId, createdDate, content) => { return ( <div className="DiaryItem"> <div className={`img_section img_section_${emotionId}`}> <img src={getEmotionImage(1)} /> </div> <div className="info_seciton"> <div className="created_date"> {new Date(createdDate).toLocaleDateString()} </div> <div className="content">{content}</div> </div> <div className="button_section"> <Button text={"수정하기"} /> </div> </div> ); }; export default DiaryItem;

  • javascript
  • react
  • node.js
capstone24star 댓글 2 좋아요 0 조회수 167

Context 질문입니다.

해결됨

한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지

첫번째 context Provider 에 {data} 두번째 context Provider 에 {onCreate,onUpdate,onDelete} 이렇게 2개를 사용해야 하는건가요? 1개로 value 에 {data, onCreate,onUpdate, onDelete} 이렇게는 안되는건가요? 안되는 거라면 이유가 있을 런지요? 복잡한 상태 관리가 필요한 경우에 종류별로 많이 사용된다면 코드가 복잡해질거 같은데요 ㅠ 그리고 실무에서 상태관리를 위해서 Redux를 많이 사용하는 거 같더라구요? 현재 react 강좌에는 Redux 내용은 없는거 같아요 ㅠㅠ 추가 보충설명 공유주시면 감사할거 같아요 ~~

  • javascript
  • node.js
babi9005 댓글 2 좋아요 1 조회수 165

전체 소스코드는 어디서 받을 수 있나요?

미해결

(2025 최신 업데이트)리액트 : 프론트엔드 개발자로 가는 마지막 단계

전체 소스코드는 어디서 받을 수 있나요?

  • react
  • redux
  • web-api
osakapark 댓글 1 좋아요 0 조회수 279

overload 에러

해결됨

따라하며 배우는 노드, 리액트 시리즈 - 레딧 사이트 만들기(NextJS)(Pages Router)

import {Router, Request, Response} from "express"; import {User} from "../entities/User"; import { validate, Validate } from "class-validator"; const register = async (req: Request, res: Response) => { const {email, username, password} = req.body; try{ let errors: any = {}; //이메일/유저이름 단일성 확인 const emailUser = await User.findOneBy({email}); const usernameUser = await User.findOneBy({username}); //이미 있으면 erros 객체에 넣음 if(emailUser) errors.email = "이미 해당 이메일 주소가 사용되었습니다." if(usernameUser) errors.username = "이미 사용자 이름이 사용되었습니다." //에러가 있으면 return으로 에러를 response 보내줌 if(Object.keys(errors).length > 0){ return res.status(400).json(errors) } const user = new User(); user.email = email; user.username = username; user.password = password; //엔터티에 정해 놓은 조건으로 user 데이터 유호성 검사를 해줌 errors = await validate(user); //유저 정보를 user table에 저장 await user.save() return res.json(user); } catch(error){ console.error(error); return res.status(500).json({error}) } } const router = Router(); router.post("/register", register); export default router 맨 위 코드(auth.ts)에서 사진과 같이 overload 에러가 뜹니다. 유저이름/이메일 중복 및 에러 처리하는 코드 중 return으로 응답을 반환하는 중 타입이 맞지 않아서 생기는 오류 같은데 어떻게 해결할 수 있을까요??

  • react
  • node.js
  • postgresql
  • docker
  • typescript
  • 클론코딩
  • next.js
마곡동김두팔 댓글 1 좋아요 0 조회수 204

왜 전부다 div태그로 만드는지 궁금합니다.

해결됨

웹 프론트엔드를 위한 자바스크립트 첫걸음

강사님 강의를 들으면서 의문이 들었는데 강사님 버튼 부분으로 되어있는 것들을 div태그로 전부다 만드시던데 혹시 이유가 따로 있을까요??? 북마크를 추가하는 부분이나 취소, 추가 부분은 button태그를 사용하거나 북마크를 입력하는 div태그 전체를 form태그로 묶어서 사용하는게 좀 더 좋지 않을까요?? 강사님이 div 태그만 사용하시던데 혹시 이유가 따로 있으신건가요??

  • javascript
  • dom
  • div
김용인 댓글 2 좋아요 1 조회수 268

[수업질문] bookmark.js에서

해결됨

웹 프론트엔드를 위한 자바스크립트 첫걸음

6, 북마크 아이템 추가하기에서 추가 버튼을 누르면 bookmarkList.push is not a function at HTMLDivElement.addBookMarkItem 이라고 콘솔에 나옵니다 ..ㅠㅠ (css와 마크업은 미리 적어두었습니다.)

  • javascript
  • dom
gmlrnjssla 댓글 2 좋아요 0 조회수 148

컴포넌트에 매개변수 전달하는 방식에 대하여

해결됨

한 번에 끝내는 자바스크립트: 바닐라 자바스크립트로 SPA 개발까지

프로젝트 작성할 때 ,APP.js와 components폴더 안의 js모듈로 보통 구성을 하시는데, 왜 APP.js에서 $app을 매개변수로 받을 때는 소괄호에서 바로 받는데, 다른 컨포넌트 내부 js모듈에서는 중괄호로 받는건가요? export default function App($app) {} export default function CityList({ $app, initialState,handleLoadMore }) {} APP의 경우 전달받는게 하나인데, CityList의 경우 APP에서 여러개의 매개변수를 받아오기 떄문에 구조분해로 받아오는 건가요? 만약 그렇다면 한개만 매개변수로 받아오는 경우, CityList도 (소괄호)안에 {중괄호}없이 바로 매개변수를 써도 되는 건가요?

  • javascript
  • rest-api
  • spa
  • dom
ggang89 댓글 2 좋아요 0 조회수 179

인기 태그

인프런 TOP Writers

주간 인기글