묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
미해결따라하며 배우는 리액트 네이티브 기초
InputForm 생성하기에서 TextInput과 Pressable이 보이지 않아요.
레이아웃 표시를 했을때, 위치는 잡히는 것 같지만 시각적으로 전혀 보이지 않아요. 마치 뒤에 가려진 것 처럼요 // InputForm.js import { KeyboardAvoidingView, Platform, Pressable, StyleSheet, Text, TextInput, View } from 'react-native' import React from 'react' const InputForm = () => { return ( <KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : 'height'} style={styles.addFormContainer}> <TextInput style={styles.inputField} placeholder="할 일을 작성해주세요." /> <Pressable style={styles.addButton}> <Text style={styles.addButtonText} >+</Text> </Pressable> </KeyboardAvoidingView> ) } export default InputForm const styles = StyleSheet.create({ addFormContainer: { flexDirection: 'row', marginTop: 'auto', marginBottom: 30, paddingHorizontal: 20, backgroundColor: '#f7f8fa' }, inputField: { flex: 1, height: 42, padding: 5, marginRight: 25, borderRadius: 4, borderColor: 'rgba(0, 0, 0, 0.2)', borderWidth: 1, color: '#000000', fontSize: 15, textAlignVertical: 'center' }, addButton: { justifyContent: 'center', alignItems: 'center', width: 42, height: 42, borderRadius: 4, backgroundColor: 'rgba(0,0,0,0.7)', shadowColor: '#000000', shadowOpacity: 0.14, shadowRadius: 8, shadowOffset: { width: 0, height: 4 } }, addButtonText: { color: 'white', fontSize: 25 }, }) // MainScreen.js import { SafeAreaView, StyleSheet, Text, View, StatusBar, Platform } from 'react-native' import React from 'react' import InputForm from '../components/InputForm' const MainScreen = () => { return ( <View> <SafeAreaView style={styles.container}> <StatusBar barStyle={'default'} /> <Text style={styles.pageTitle}>ToDo App</Text> <View style={styles.listView}> <Text style={styles.listTitle}>할 일</Text> </View> <View style={styles.separator} /> <View style={styles.listView}> <Text style={styles.listTitle}>완료된 일</Text> </View> <InputForm /> </SafeAreaView> </View> ) } export default MainScreen const styles = StyleSheet.create({ container: { flex: 1, paddingTop: Platform.OS = 'android' ? 20 : 0, backgroundColor: '#f7f8fa' }, pageTitle: { marginBottom: 35, paddingHorizontal: 15, fontSize: 54, fontWeight: '600', }, separator: { marginHorizontal: 10, marginTop: 25, marginBottom: 10, borderBottomWidth: 1, borderBottomColor: 'rgba(0,0,0,0.2)' }, listView: { flex: 1, }, listTitle: { marginBottom: 25, paddingHorizontal: 15, fontSize: 41, fontWeight: '500', } }) // App.js import { StyleSheet, Text, View } from 'react-native'; import MainScreen from './screens/MainScreen'; export default function App() { return ( <View style={styles.container}> <MainScreen /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'flex-start', justifyContent: 'center', }, }); // package.json { "name": "awesomeproject", "version": "1.0.0", "main": "node_modules/expo/AppEntry.js", "scripts": { "start": "expo start", "android": "expo start --android", "ios": "expo start --ios", "web": "expo start --web" }, "dependencies": { "expo": "^51.0.27", "expo-status-bar": "~1.12.1", "react": "18.2.0", "react-native": "0.74.5" }, "devDependencies": { "@babel/core": "^7.24.0" }, "private": true }
-
해결됨파이썬/장고 웹서비스 개발 완벽 가이드 with 리액트 (장고 4.2 기준)
IP Field와 AccessLog 관련
질문을 온전히 이해할 수 있도록, 모든 맥락을 전달해주세요.질문은 질문자가 번거로워야 보다 좋은 답변을 얻으실 수 있습니다.시행착오를 알려주시면 곧바로 원하는 문제에 집중할 수 있습니다.오류 메시지는 일부만 알려주시기보다 전체 오류 메시지를 캡처해서 주시면, 오류 파악에 도움이 됩니다. 당신의 파이썬/장고 페이스메이커가 되겠습니다. ;-)인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. Q17-01 02 강의에서 ipv4address custom field를 생성하셨는데요8-20 강의 같이 이후에는 그냥 Django GenericIPAddressField를 사용셨습니다.7-01 02강의는 그냥 custom 필드를 보여주기 위한 예시이고 그냥 장고에서 제공해주는 IP 필드를 사용하면 되는건가요? 아니면 차이점이 존재하는 건가요? Q2제가 제작한 사이트의 사용량 집계를 위해 로그를 얻으려고 합니다.class AccessLog(models.Model): request = models.URLField() time = models.DateTimeField(auto_now=True) user = models.ForeignKey(User, on_delete=models.CASCADE, null=True) ip = models.GenericIPAddressField()상기와 같은 모델을 작성하여 request가 client로 날라올 때마다 db에 쌓아나가는게 맞을까요? 아니라면 logger를 이용하는게 맞을까요?
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
강의의 eslintrc와 eslint.config의 차이가 무엇인가요?
강의 6분 17초에 eslintrc 파일은저에게는 eslint.config.js로 나와서 문의드립니다!안에 내용도 좀 다르고 저는 eslint.config.js. 파일만 있어서요!같다고 봐야할까요?
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기
postman 에 답이 오지 않습니다.(수정)
브라우저를 실행 했습니다 문제는이렇게 보내고이런 에러가 났습니다.또한 터미널에는 아무런 값도 뜨지않고이상태 그대로 입니다. 무엇이 문제일까요?아래 처럼되지 않습니다.<예제가 바르게 작동된 모습> const express = require('express'); const router = express.Router(); const structjson = require('./structjson.js'); const dialogflow = require('dialogflow'); const uuid = require('uuid'); const config = require('../config/keys'); const projectId = config.googleProjectID const sessionId = config.dialogFlowSessionID const languageCode = config.dialogFlowSessionLanguageCode // Create a new session const sessionClient = new dialogflow.SessionsClient(); const sessionPath = sessionClient.sessionPath(projectId, sessionId); // We will make two routes // Text Query Route router.post('/textQuery', async (req, res) => { //We need to send some information that comes from the client to Dialogflow API // The text query request. const request = { session: sessionPath, queryInput: { text: { // The query to send to the dialogflow agent text: req.body.text, // The language used by the client (en-US) languageCode: languageCode, }, }, }; // Send request and log result const responses = await sessionClient.detectIntent(request); console.log('Detected intent'); const result = responses[0].queryResult; console.log(` Query: ${result.queryText}`); console.log(` Response: ${result.fulfillmentText}`); res.send(result) }) //Event Query Route router.post('/eventQuery', async (req, res) => { //We need to send some information that comes from the client to Dialogflow API // The text query request. const request = { session: sessionPath, queryInput: { event: { // The query to send to the dialogflow agent name: req.body.event, // The language used by the client (en-US) languageCode: languageCode, }, }, }; // Send request and log result const responses = await sessionClient.detectIntent(request); console.log('Detected intent'); const result = responses[0].queryResult; console.log(` Query: ${result.queryText}`); console.log(` Response: ${result.fulfillmentText}`); res.send(result) }) module.exports = router; 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}`) }); { "name": "chatbot-app", "version": "1.0.0", "description": "chatbot-app", "main": "index.js", "engines": { "node": ">=20.16.0", "npm": ">=10.2.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": "^2.6.0", "body-parser": "^1.18.3", "dialogflow": "^1.2.0", "dialogflow-fulfillment": "^0.6.1", "express": "^4.16.4", "mongoose": "^5.4.20" }, "devDependencies": { "concurrently": "^4.1.0", "nodemon": "^1.18.10" } }
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기
최신버전 부분
제이슨파일에 최신 버전으로 호환이될 수 있게 방법을 알려주시면 좋을 것 같습니다!!
-
미해결따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기
웹브라우저 실행이 안됩니다 .인스톨도 안되구요. 최신버전으로 해서 진행하고 자 하는데 어떻게 하면 될가요?
웹브라우저 실행이 안됩니다 .{ "name": "chatbot-app", "version": "1.0.0", "description": "chatbot-app", "main": "index.js", "engines": { "node": ">=20.16.0", "npm": ">=10.2.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": "^2.6.0", "body-parser": "^1.18.3", "dialogflow": "^0.8.2", "dialogflow-fulfillment": "^0.6.1", "express": "^4.16.4", "mongoose": "^5.4.20" }, "devDependencies": { "concurrently": "^4.1.0", "nodemon": "^1.18.10" } } const express = require('express'); const router = express.Router(); const structjson = require('./structjson.js'); const dialogflow = require('dialogflow'); const uuid = require('uuid'); const config = require('../config/keys'); const projectId = config.googleProjectID const sessionId = config.dialogFlowSessionID const languageCode = config.dialogFlowSessionLanguageCode // Create a new session const sessionClient = new dialogflow.SessionsClient(); const sessionPath = sessionClient.sessionPath(projectId, sessionId); // We will make two routes // Text Query Route router.post('/textQuery', async (req, res) => { //We need to send some information that comes from the client to Dialogflow API // The text query request. const request = { session: sessionPath, queryInput: { text: { // The query to send to the dialogflow agent text: req.body.text, // The language used by the client (en-US) languageCode: languageCode, }, }, }; // Send request and log result const responses = await sessionClient.detectIntent(request); console.log('Detected intent'); const result = responses[0].queryResult; console.log(` Query: ${result.queryText}`); console.log(` Response: ${result.fulfillmentText}`); res.send(result) }) //Event Query Route router.post('/eventQuery', async (req, res) => { //We need to send some information that comes from the client to Dialogflow API // The text query request. const request = { session: sessionPath, queryInput: { event: { // The query to send to the dialogflow agent name: req.body.event, // The language used by the client (en-US) languageCode: languageCode, }, }, }; // Send request and log result const responses = await sessionClient.detectIntent(request); console.log('Detected intent'); const result = responses[0].queryResult; console.log(` Query: ${result.queryText}`); console.log(` Response: ${result.fulfillmentText}`); res.send(result) }) module.exports = router;
-
해결됨[코드캠프] 부트캠프에서 만든 고농축 프론트엔드 코스
04-02-graphql-mutation
api 요청하기를 눌러도 콘솔창에 아무것도 안떠요
-
미해결코드로 배우는 React 19 with 스프링부트 API서버
Redux에서 <provider >사용시 오류 -Cannot read properties of undefined (reading ‘getState’)
안녕하세요 열심히 강의 듣고 있습니다. 거의 중 후반까지 왔어요. jwt 강의 까지 듣고 많은걸 알게 되어서 많이 기쁩니다. 자신감이 많이 생겼네요.(참고로 java는 잘 못해서 kotlin으로 다 컨버팅 했네요 .... )https://github.com/justkjy/apiserver 컨버팅 작업 하니깐 2번 듣게 되고 정확하게 이해가 되네요 ...== 본론 === 리덕스 툴킷 설정 강의에서 알려주신 코드를 따라 쳤는데 에러가 났어요..const root = ReactDOM.createRoot(document.getElementById('root')); // root.render( // <Provider strote={store}> // <App /> // </Provider> // ); root.render( <App /> );Cannot read properties of undefined (reading ‘getState’) 그래서 provider를 지워라고 하네요...이게 맞나요??인프런 이슈 정보에도 지워라고 하긴 하는데 ===========https://www.inflearn.com/community/questions/36034/%EC%A0%9C%EB%A1%9C%EC%B4%88%EB%8B%98-%EC%BD%94%EB%93%9C%EB%A5%BC-%EB%94%B0%EB%9D%BC%EC%84%9C%EB%8F%84-%EA%B7%B8%EB%8C%80%EB%A1%9C-%EB%B3%B5%EC%82%AC%ED%96%88%EB%8A%94%EB%8D%B0-%EC%9D%B4-%EB%AC%B4%EC%8A%A8%EC%97%90%EB%9F%AC%EC%9D%B8%EA%B0%80%EC%9A%94-%EB%AA%87%EC%9D%BC%EC%A7%B8-%ED%95%B4%EA%B2%B0-%EB%AA%BB%ED%95%98%EA%B3%A0-%EC%9E%88%EC%8A%B5%EB%8B%88%EB%8B%A4================================= 저렇게 하면 강의 따라 가는데 문제가 없을까요?리덕스 툴킷 설정
-
미해결Next + React Query로 SNS 서비스 만들기
2장 클론 코딩시 화면 하단에 회색 영역이 생김니다.
강좌와 git을 보면서 했는데,왜 아래에 회색영역이 생기는 건지 잘 모르겠습니다.ㅜㅜ세로로 생기는 스크롤도 흰색영역에만 생깁니다.그런데 로그아웃버튼은 회색영역에 생기네요이리저리 해봐도 잘 모르겠어서 도움을 요청합니다
-
미해결Next + React Query로 SNS 서비스 만들기
서로 다른 컴포넌트간 query 일치하게 하기 강의중
안녕하세여 제로초님 UserInfo에서 팔로우버튼을 누르면 팔로잉으로 변해야되고 다시 한번 누르면 팔로우로 변해야되는데 버튼을 누르고 새로고침을 해야지만 반영이됩니다... 팔로우 추천에서는 바로 반영이 되는데....깃허브 ch3-2 UserInfo에 있는 코드로 가져다 써도 안되네여 ㅠㅠ"use client"; import style from "@/app/(afterLogin)/[username]/profile.module.css"; import BackButton from "@/app/(afterLogin)/_component/BackButton"; import { useQuery, useQueryClient, useMutation } from "@tanstack/react-query"; import { User } from "@/model/User"; import { getUser } from "@/app/(afterLogin)/[username]/_lib/getUser"; import cx from "classnames"; import { MouseEventHandler } from "react"; import { Session } from "@auth/core/types"; type Props = { username: string; session: Session | null; }; export default function UserInfo({ username, session }: Props) { const { data: user, error } = useQuery< User, Object, User, [_1: string, _2: string] >({ queryKey: ["users", username], queryFn: getUser, staleTime: 60 * 1000, // fresh -> stale, 5분이라는 기준 gcTime: 300 * 1000, }); const queryClient = useQueryClient(); const follow = useMutation({ mutationFn: (userId: string) => { console.log("follow", userId); return fetch( `${process.env.NEXT_PUBLIC_BASE_URL}/api/users/${userId}/follow`, { credentials: "include", method: "post", } ); }, onMutate(userId: string) { const value: User[] | undefined = queryClient.getQueryData([ "users", "followRecommends", ]); if (value) { const index = value.findIndex((v) => v.id === userId); if (index > -1) { console.log(value, userId, index); const shallow = [...value]; shallow[index] = { ...shallow[index], Followers: [{ id: session?.user?.email as string }], _count: { ...shallow[index]._count, Followers: shallow[index]._count?.Followers + 1, }, }; queryClient.setQueryData(["users", "followRecommends"], shallow); } } const value2: User | undefined = queryClient.getQueryData([ "users", userId, ]); if (value2) { const shallow: User = { ...value2, Followers: [{ id: session?.user?.email as string }], _count: { ...value2._count, Followers: value2._count?.Followers + 1, }, }; queryClient.setQueryData(["users", userId], shallow); } }, onError(error, userId: string) { console.error(error); const value: User[] | undefined = queryClient.getQueryData([ "users", "followRecommends", ]); if (value) { const index = value.findIndex((v) => v.id === userId); console.log(value, userId, index); if (index > -1) { const shallow = [...value]; shallow[index] = { ...shallow[index], Followers: shallow[index].Followers.filter( (v) => v.id !== session?.user?.email ), _count: { ...shallow[index]._count, Followers: shallow[index]._count?.Followers - 1, }, }; queryClient.setQueryData(["users", "followRecommends"], shallow); } const value2: User | undefined = queryClient.getQueryData([ "users", userId, ]); if (value2) { const shallow = { ...value2, Followers: value2.Followers.filter( (v) => v.id !== session?.user?.email ), _count: { ...value2._count, Followers: value2._count?.Followers - 1, }, }; queryClient.setQueryData(["users", userId], shallow); } } }, }); const unfollow = useMutation({ mutationFn: (userId: string) => { console.log("unfollow", userId); return fetch( `${process.env.NEXT_PUBLIC_BASE_URL}/api/users/${userId}/follow`, { credentials: "include", method: "delete", } ); }, onMutate(userId: string) { const value: User[] | undefined = queryClient.getQueryData([ "users", "followRecommends", ]); if (value) { const index = value.findIndex((v) => v.id === userId); console.log(value, userId, index); if (index > -1) { const shallow = [...value]; shallow[index] = { ...shallow[index], Followers: shallow[index].Followers.filter( (v) => v.id !== session?.user?.email ), _count: { ...shallow[index]._count, Followers: shallow[index]._count?.Followers - 1, }, }; queryClient.setQueryData(["users", "followRecommends"], shallow); } const value2: User | undefined = queryClient.getQueryData([ "users", userId, ]); if (value2) { const shallow = { ...value2, Followers: value2.Followers.filter( (v) => v.id !== session?.user?.email ), _count: { ...value2._count, Followers: value2._count?.Followers - 1, }, }; queryClient.setQueryData(["users", userId], shallow); } } }, onError(error, userId: string) { console.error(error); const value: User[] | undefined = queryClient.getQueryData([ "users", "followRecommends", ]); if (value) { const index = value.findIndex((v) => v.id === userId); console.log(value, userId, index); if (index > -1) { const shallow = [...value]; shallow[index] = { ...shallow[index], Followers: [{ id: session?.user?.email as string }], _count: { ...shallow[index]._count, Followers: shallow[index]._count?.Followers + 1, }, }; queryClient.setQueryData(["users", "followRecommends"], shallow); } } const value2: User | undefined = queryClient.getQueryData([ "users", userId, ]); if (value2) { const shallow = { ...value2, Followers: [{ userId: session?.user?.email as string }], _count: { ...value2._count, Followers: value2._count?.Followers + 1, }, }; queryClient.setQueryData(["users", userId], shallow); } }, }); console.log("error"); console.dir(error); if (error) { return ( <> <div className={style.header}> <BackButton /> <h3 className={style.headerTitle}>프로필</h3> </div> <div className={style.userZone}> <div className={style.userImage}></div> <div className={style.userName}> <div>@{username}</div> </div> </div> <div style={{ height: 100, alignItems: "center", fontSize: 31, fontWeight: "bold", justifyContent: "center", display: "flex", }} > 계정이 존재하지 않음 </div> </> ); } if (!user) { return null; } const followed = user.Followers?.find((v) => v.id === session?.user?.email); console.log(session?.user?.email, followed); const onFollow: MouseEventHandler<HTMLButtonElement> = (e) => { e.stopPropagation(); e.preventDefault(); console.log("follow", followed, user.id); if (followed) { unfollow.mutate(user.id); } else { follow.mutate(user.id); } }; return ( <> <div className={style.header}> <BackButton /> <h3 className={style.headerTitle}>{user.nickname}</h3> </div> <div className={style.userZone}> <div className={style.userRow}> <div className={style.userImage}> <img src={user.image} alt={user.id} /> </div> <div className={style.userName}> <div>{user.nickname}</div> <div>@{user.id}</div> </div> {user.id !== session?.user?.email && ( <button onClick={onFollow} className={cx(style.followButton, followed && style.followed)} > {followed ? "팔로잉" : "팔로우"} </button> )} </div> <div className={style.userFollower}> <div>{user._count.Followers} 팔로워</div> <div>{user._count.Followings} 팔로우 중</div> </div> </div> </> ); }제가 보기에는 useQuery가 제대로 작동안하는거같은데...제로초님 의견이 궁금합니다팔로우버튼 안눌렀을때 팔로우버튼 눌렀을때
-
미해결React + GPT API로 AI회고록 서비스 개발 (원데이 클래스)
웹브라우저에서 글만작성하면 에러가 납니다
import { Input, Button} from 'antd'; const { TextArea } = Input; import { useState } from "react";// 저장하는 곳임포트 const DiaryInput = ({ isLoading, onSubmit }) => { const [userInput, setUserInput] = useState(""); // isLoading 로딩상태에서 사용하는 변수 // inSubmit 다입력 작성하면 사용 const handleUserInput = (e) => { setUserInput(e.target.value); }; const handleClick = () => { onSubmit(userInput); }; return ( <div> <TextArea value={userInput} onChange={handleUserInput} placeholder="오늘 일어난 일들을 간단히 적어주세요." /> <Button loading={isLoading} onClick={handleClick}> GPT 회고록을 작성해줘! </Button> </div> ); } export default DiaryInput; // import { Input , Button} from 'antd'; // import { useState } from 'react'; // const { TextArea } = Input; // const DiaryInput = ({isLoading, onSubmit}) => { // const [userInput, setUserInput] = useState(""); // //사용자의 입력을 받아 상위 컴포넌트로 넘기기 // // 로딩상태에서는 제출버튼 못누루게 // const handleUserInput =(e)=>{ // setUserInput(e.target.value); // const handleClick = ()=>{ // onSubmit(userInput); // } // } // return ( // <div> // <TextArea value={userInput} onChange={handleUserInput} placeholder='오늘 하루 회고'/> // <Button loading={isLoading} onClick={handleClick}>GPT회고록 시작</Button> // </div> // ); // }; // export default DiaryInput;import { useState } from 'react'; import { CallGPT } from './api/gpt'; import DiaryInput from './components/DiaryInput'; const dummyData = { "title": "고립된 개발자의 고민", "thumbnail": "https://source.unsplash.com/1600x900/?programming", "summary": "혼자 코딩과제를 진행하면서 걱정이다.", "emotional_content": "최근 혼자 코딩과제를 진행하면서, 협업이 없이 모든 것을 혼자 결정하고 해결해야 한다는 부담감에 많이 무겁습니다. 강의를 듣고 최선을 다해 프로젝트를 진행했지만, 예상치 못한 버그들로 인해 스트레스가 많이 쌓였습니다. 스택오버플로와 GPT를 통해 문제를 해결하긴 했지만, 이러한 문제해결 방식이 정말로 제 개발 실력을 향상시키는지에 대해 의문이 듭니다. 왠지 스스로의 능력을 시험할 기회를 잃은 것 같아 아쉽고, 불안감도 커지고 있습니다.", "emotional_result": "이 일기에서 감지되는 감정은 불안, 부담감, 그리고 자신감의 결여입니다. 고립된 상황에서의 성공에 대한 압박감과 문제 해결 방법에 대한 의심은 정서적으로 큰 부담을 주고 있습니다. 자기 효능감이 낮아짐을 느끼는 상황입니다.", "analysis": "고립되어 문제를 해결하는 과정은 큰 스트레스와 불안을 유발할 수 있습니다. '혼자서 하는 일은 좋은 일이든 나쁜 일이든 더욱 크게 느껴진다'는 에릭 에릭슨의 말처럼, 혼자서 모든 것을 해결하려는 시도는 때로는 개인의 성장에 도움이 될 수 있지만, 지속적인 고립은 자기 효능감을 저하시킬 수 있습니다. 이러한 상황에서는 자신의 노력을 인정하고, 필요한 경우 도움을 요청하는 것이 중요합니다.", "action_list": [ "프로젝트 중 발생하는 문제를 혼자 해결하려 하지 말고, 멘토나 동료 개발자와 상의를 통해 해결 방안을 모색하라.", "정기적으로 자신의 학습 방법과 진행 상황을 평가하여, 필요한 경우 학습 방식을 조정하라.", "개발 과정에서의 스트레스 관리를 위해 적절한 휴식과 여가 활동을 통해 정서적 안정을 찾으라." ] }; function App() { const [data, setData] = useState(dummyData); // 우선 빈문자열로 해놓고 const [isLoading, setIsLoading] = useState(false); const handleClickAPICall = async (userInput) => { try { setIsLoading(true);// 처음에는 로딩을 트루 const message = await CallGPT({ prompt: `${userInput}`, }); // Assuming callGPT is a function that fetches data from GPT API setData(JSON.parse(message)); } catch (error) { // Handle error (you might want to set some error state here) } finally { setIsLoading(false);//다음에는 펄스로 } }; const handleSubmit = (userInput) => { handleClickAPICall(userInput); }; console.log(">>data", data); return ( <> <DiaryInput isLoading={isLoading} onSubmit ={handleSubmit} /> <button onClick={handleClickAPICall}>GPT API call</button> <div>title : {data?.title}</div> <div>analysis : {data?.analysis}</div> <div>emotional_content : {data?.emotional_content}</div> <div>emotional_result : {data?.emotional_result}</div> </> ); }; export default App; // import { useState } from "react"; // import { CallGPT } from "./api/gpt"; // import { message } from "antd"; // import DiaryInput from "./components/DiaryInput"; // const dumyData = JSON.parse(` // { // "title": "당황스러운 예제 에러", // "thumbnail": "https://source.unsplash.com/1600x900/?confused", // "summary": "가끔 예제 에러가 발생하여 당황함", // "emotional_content": "가끔 예제 에러가 나타나는 것이 정말 당황스럽다. 이런 상황들은 예상치 못한 문제로 인해 나를 혼란스럽게 만든다. 그럼에도 불구하고, 이런 에러들은 동시에 나의 문제 해결 능력을 시험한다.", // "emotional_result": "당황스러움과 혼란스러움이 느껴진다. 그러나 이는 예상치 못한 문제에 대처하는 능력을 향상시키는 과정일 수 있다.", // "analysis": "당신의 당황함과 혼란스러움은 예상치 못한 상황에 대한 불안감과 두려움을 반영할 수 있습니다. 하지만, '문제는 기회다'라는 유명한 격언을 기억하십시오. 이러한 에러들은 당신의 문제 해결 능력을 향상시키는 좋은 기회일 수 있습니다.", // "action_list": [ // "예상치 못한 에러에 대비하는 습관 만들기", // "문제 해결 능력 향상을 위한 자기계발", // "당황하지 않고 차분하게 상황을 평가하는 능력 기르기" // ] // } // `); // function App() { // const [data, setData] = useState(dumyData); // const [isLoading, setIsLoading] = useState(false); // // 여기로딩상태가 // const handleClickAPICall = async (userInput) => { // try{// try catch로 감싸서, 처음에는 로딩상태를 트루라고 하고 // setIsLoading(true); // const message = await CallGPT({ // prompt:'{userInput}', // }); // setData(JSON.parse(message));// 그리고 데이터가 잘오면 받아보자 // } catch (error){ // }finally{ // setIsLoading(false);// 나중에는 false라고 하자 // } // }; // const handleSubmit = (userInput)=>{ // handleClickAPICall(userInput); // }; // console.log(">>data", data); // return ( // <> // <DiaryInput isLoading={isLoading} onSubmit={handleSubmit} /> // // 여기로 옴 // <button onClick={handleClickAPICall}>GPT API call</button> // <div>data : {data?.title}</div> // <div>thumbnail: {data?.thumbnail}</div> // <div>summary : {data?.summary}</div> // <div>emotional_resul : {data?.emotional_resul}</div> // <div>emotional_content : {data?.emotional_content}</div> // <div>analysis: {data?.analysis}</div> // <div>action_list: {data?.action_list}</div> // </> // ); // } // export default App;{ "name": "my-gpt-diary", "private": true, "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "tsc -b && vite build", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, "dependencies": { "@ant-design/icons": "^5.4.0", "antd": "^5.20.1", "react": "^18.3.1", "react-dom": "^18.3.1", "styled-components": "^6.1.12" }, "devDependencies": { "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^7.15.0", "@typescript-eslint/parser": "^7.15.0", "@vitejs/plugin-react": "^4.3.1", "eslint": "^8.57.0", "eslint-plugin-react-hooks": "^4.6.2", "eslint-plugin-react-refresh": "^0.4.7", "typescript": "^5.2.2", "vite": "^5.3.4" } }
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
npm i npm warn 에러
🚨 아래의 가이드라인을 꼭 읽고 질문을 올려주시기 바랍니다 🚨질문 하시기 전에 꼭 확인해주세요- 질문 전 구글에 먼저 검색해보세요 (답변을 기다리는 시간을 아낄 수 있습니다)- 코드에 오타가 없는지 면밀히 체크해보세요 (Date와 Data를 많이 헷갈리십니다)- 이전에 올린 질문에 달린 답변들에 꼭 반응해주세요 (질문에 대한 답변만 받으시고 쌩 가시면 속상해요 😢)질문 하실때 꼭 확인하세요- 제목만 보고도 무슨 문제가 있는지 대충 알 수 있도록 자세한 제목을 정해주세요 (단순 단어 X)- 질문의 배경정보를 제공해주세요 (이 문제가 언제 어떻게 발생했고 어디까지 시도해보셨는지)- 문제를 재현하도록 코드샌드박스나 깃허브 링크로 전달해주세요 (프로젝트 코드에서 문제가 발생할 경우)- 답변이 달렸다면 꼭 확인하고 반응을 남겨주세요- 강의의 몇 분 몇 초 관련 질문인지 알려주세요!- 서로 예의를 지키며 존중하는 문화를 만들어가요. - 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.npm warn deprecated @humanwhocodes/config-array@0.11.14: Use @eslint/config-array insteadnpm warn deprecated rimraf@3.0.2: Rimraf versions prior to v4 are no longer supportednpm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supportednpm warn deprecated @humanwhocodes/object-schema@2.0.3: Use @eslint/object-schema insteadnpm i를 할 때마다 언제부턴가 npm warn이라는 경고창이 뜹니다 왜 이런거죠? ㅠㅡㅠ 찾아보니 최신화를 시켜주라는 말이 있던데 잘 모르기도 하고 괜한 짓을 할까봐여쭤봅니다...!!!
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
useMemo관련 질문드립니다
import React, { useCallback, useMemo } from "react"; import "../List.css"; import TodoItem from "./TodoItem"; import { useState } from "react"; const List = ({ todos, onUpdate, onDelete }) => { const [search, setSearch] = useState(""); console.log(todos); const onChangeSearch = (e) => { setSearch(e.target.value); }; const getFilteredData = () => { if (search === "") { return todos; } else { return todos.filter((todo) => todo.content.toLowerCase().includes(search.toLowerCase()) ); } }; const filteredTodos = getFilteredData(); const getAnalyedData = () => { console.log("getAnalyedData"); const totalCount = todos.length; const doneCount = todos.filter((todo) => todo.isDone).length; const notDoneCount = totalCount - doneCount; return { totalCount, doneCount, notDoneCount, }; }; const analyzedData = useMemo(() => { return getAnalyedData(); }, [todos]); return ( <div className="List"> <div className="GetAnalyedData"> <h1>total :::{analyzedData.totalCount}</h1> <h1>done :::{analyzedData.doneCount}</h1> <h1>notDone:::{analyzedData.notDoneCount}</h1> </div> <h4>검색어</h4> <input placeholder="검색어 입력" onChange={onChangeSearch} value={search} /> <div className="todos_wrapper"> {filteredTodos.map((todo) => { return ( <TodoItem key={todo.id} {...todo} onUpdate={onUpdate} onDelete={onDelete} /> ); })} </div> </div> ); }; export default List; const getAnalyedData = () => { console.log("getAnalyedData"); const totalCount = todos.length; const doneCount = todos.filter((todo) => todo.isDone).length; const notDoneCount = totalCount - doneCount; return { totalCount, doneCount, notDoneCount, }; }; const analyzedData = useMemo(() => { return getAnalyedData(); }, [todos]);이런식으로 넣어도 혹시 가능할까요 ??? Line 36:6: React Hook useMemo has a missing dependency: 'getAnalyedData'. Either include it or remove the dependency array react-hooks/exhaustive-deps이런 에러가 떠서요 ..기능은 돌던데
-
해결됨한 입 크기로 잘라 먹는 리액트(React.js) : 기초부터 실전까지
console.log 출력이 되지않습니다
chapter03.js 에 console.log("Hello"); 를 입력하고index.html에 <html> <head> <sciprt src="./chapter03.js"></sciprt> </head> <body> Hello World </body> </html>를 입력했는데 콘솔창에 Hello가 뜨지않습니다 뭐가 문제일까요 ㅠㅠ? html에서 live server 실행시켰습니다
-
해결됨따라하며 배우는 노드, 리액트 시리즈 - 챗봇 사이트 만들기
포스트맨에서 send를 하였을 때 오류가 납니다.
D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:427 return Error(s); ^Error: The file at "D:\다운로드\test-chat-bot-app-432113-2e08177eda4a.json" does not exist, or it is not a file. Error: ENOENT: no such file or directory, lstat 'D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\"D:' at GoogleAuth.createError (D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:427:16) at GoogleAuth.<anonymous> (D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:273:28) at Generator.next (<anonymous>) at D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:22:71 at new Promise (<anonymous>) at __awaiter (D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:18:12) at GoogleAuth._getApplicationCredentialsFromFilePath (D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:257:16) at GoogleAuth.<anonymous> (D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:202:29) at Generator.next (<anonymous>) at D:\다운로드\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\chatbot-app-56b70f8517a33ac618d6b1b5684bf304f84358b4\node_modules\google-auth-library\build\src\auth\googleauth.js:22:71 npm start run 이후 포스트맨에서 send를 누르면 이런식으로 나오네요 문제가 뭔지 잘 모르겠습니다....
-
해결됨코드로 배우는 React 19 with 스프링부트 API서버
[스프링부트 3.2] RefreshToken 발급시 파라미터 오류
스프링부트 3.2 버전인데 APIRefreshController의 refresh의 파라미터중 String refreshToken만 적으면 -parameter 오류가 나네요. 인텔리제이에서 gradle로 빌드하거나 어노테이션에 이름을 붙여 적으니 잘 동작합니다. 식겁했습니다..
-
미해결Supabase, Next 풀 스택 시작하기 (feat. 슈파베이스 OAuth, nextjs 14)
로딩에 대한 질문
현재 투두 페이지에서 새로고침을 하면empty -> loading -> todolist 보여짐 이렇게 되는데,loading -> emptyloading -> todolist와 같이 로딩 후에 데이터가 없으면 empty가 보여지고, 데이터가 있으면 todolist가 보여지는 구조로 가야하지 않나요?
-
미해결React + GPT API로 AI회고록 서비스 개발 (원데이 클래스)
질문있어요. React 사용자 처리 수업에서
이게 계속로딩중이라고 뜹니다import { Input, Button} from 'antd'; const { TextArea } = Input; import { useState } from "react";// 저장하는 곳임포트 const DiaryInput = (isLoading, onSubmit) => { const [userInput, setUserInput] = useState(""); // isLoading 로딩상태에서 사용하는 변수 // inSubmit 다입력 작성하면 사용 const handleUserInput = (e) => { setUserInput(e.target.value); }; const handleClick = () => { onSubmit(userInput); }; return ( <div> <TextArea value={userInput} onChange={handleUserInput} placeholder="오늘 일어난 일들을 간단히 적어주세요." /> <Button loading={isLoading} onClick={handleClick}> GPT 회고록을 작성해줘! </Button> </div> ); } export default DiaryInput;import { useState } from 'react'; import { CallGPT } from './api/gpt'; import DiaryInput from './components/DiaryInput'; const dummyData = { "title": "고립된 개발자의 고민", "thumbnail": "https://source.unsplash.com/1600x900/?programming", "summary": "혼자 코딩과제를 진행하면서 걱정이다.", "emotional_content": "최근 혼자 코딩과제를 진행하면서, 협업이 없이 모든 것을 혼자 결정하고 해결해야 한다는 부담감에 많이 무겁습니다. 강의를 듣고 최선을 다해 프로젝트를 진행했지만, 예상치 못한 버그들로 인해 스트레스가 많이 쌓였습니다. 스택오버플로와 GPT를 통해 문제를 해결하긴 했지만, 이러한 문제해결 방식이 정말로 제 개발 실력을 향상시키는지에 대해 의문이 듭니다. 왠지 스스로의 능력을 시험할 기회를 잃은 것 같아 아쉽고, 불안감도 커지고 있습니다.", "emotional_result": "이 일기에서 감지되는 감정은 불안, 부담감, 그리고 자신감의 결여입니다. 고립된 상황에서의 성공에 대한 압박감과 문제 해결 방법에 대한 의심은 정서적으로 큰 부담을 주고 있습니다. 자기 효능감이 낮아짐을 느끼는 상황입니다.", "analysis": "고립되어 문제를 해결하는 과정은 큰 스트레스와 불안을 유발할 수 있습니다. '혼자서 하는 일은 좋은 일이든 나쁜 일이든 더욱 크게 느껴진다'는 에릭 에릭슨의 말처럼, 혼자서 모든 것을 해결하려는 시도는 때로는 개인의 성장에 도움이 될 수 있지만, 지속적인 고립은 자기 효능감을 저하시킬 수 있습니다. 이러한 상황에서는 자신의 노력을 인정하고, 필요한 경우 도움을 요청하는 것이 중요합니다.", "action_list": [ "프로젝트 중 발생하는 문제를 혼자 해결하려 하지 말고, 멘토나 동료 개발자와 상의를 통해 해결 방안을 모색하라.", "정기적으로 자신의 학습 방법과 진행 상황을 평가하여, 필요한 경우 학습 방식을 조정하라.", "개발 과정에서의 스트레스 관리를 위해 적절한 휴식과 여가 활동을 통해 정서적 안정을 찾으라." ] }; function App() { const [data, setData] = useState(dummyData); // 우선 빈문자열로 해놓고 const [isLoading, setIsLoading] = useState(false); const handleClickAPICall = async (userInput) => { try { setIsLoading(true);// 처음에는 로딩을 트루 const message = await CallGPT({ prompt: `${userInput}`, }); // Assuming callGPT is a function that fetches data from GPT API setData(JSON.parse(message)); } catch (error) { // Handle error (you might want to set some error state here) } finally { setIsLoading(false);//다음에는 펄스로 } }; const handleSubmit = (userInput) => { handleClickAPICall(userInput); }; console.log(">>data", data); return ( <> <DiaryInput isLoading={isLoading} onSubmit ={handleSubmit} /> <button onClick={handleClickAPICall}>GPT API call</button> <div>title : {data?.title}</div> <div>analysis : {data?.analysis}</div> <div>emotional_content : {data?.emotional_content}</div> <div>emotional_result : {data?.emotional_result}</div> </> ); }; export default App;
-
미해결코드로 배우는 React 19 with 스프링부트 API서버
ModelMapper 와 entityToDto 차이
강사님의 강의에서 엔티티를 DTO로 변환할때 2가지 방식을 다 보여주셨는데 , 모델 매퍼로 엔티티 -> DTO 변환방식과 entityToDto 메소드 처럼 직접 개발자가 명시해줘서 엔티티를 DTO로 변환하는 방식의 차이점과 선택기준이 궁금합니다!!
-
미해결Next + React Query로 SNS 서비스 만들기
tailwind
안녕하세요 선생님.요즘 기업 트렌드에 맞게 tailwind로 진행해보려고 하는데강의 css 참고하면서 저 만의 방법으로 tailwind로 수정해서 진행해도 상관없겠죠! 혹시 css로 진행한 이유가 있을까요? 요즘 기업에선 tailwind를 더 추구하나요?저는 tailwind가 더 익숙하더라구요.. 유튜브에서 우연히 제로초 개발자님을 뵙게되어, 제로초의 JS교재와 함께 큰 도움이 되어서 인프런 강의까지 듣게됐네요. 감사합니다!