173만명의 커뮤니티!! 함께 토론해봐요.
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 본 강의 예시에서 import MyReact from "./lib/MyReact"; import React from "react"; export default () => { const ref1 = MyReact.useRef(1); const ref2 = MyReact.useRef(); const [state, setState] = React.useState(0); console.log(state) if (state > 2) { console.log("hihi"); ref1.current = ref1.current + 1; } return ( <> <button onClick={() => setState(state + 1)}> state increase (state: {state}) </button> <div>{ref1.current}</div> <input ref={ref2}></input> <button onClick={() => console.log("input value", ref2.current.value)}> ref2 select </button> </> ); }; state >2 이면 값이 증가하는것을 확인했는데 이후에도 계속 state가 2 초과 이니까 계속 ref1.current가 증가할 줄 알았는데 아니더라구요 왜그런건가요?
react React-Context react-hooks react-router react-component
dohyun_lim
2024-03-19T01:59:13.291Z
댓글 1
좋아요 1
조회수 347
미해결
프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
안녕하세요. 이전강의들을 포함해서, "파이썬 기본 환경 설정(2-1) : 개발 환경 설정(Vscode) - Windows" 강의 내용을 그대로 따라서 했습니다. 그런데 해당 강의 동영상의 25:33에서처럼 Ctrl+F5 단축키를 누르거나 Run 메뉴에서 Run Without Debugging을 직접 선택해도, 강의에서처럼 Hello python!이 출력되지 않고 이렇게 Select debugger라고 나옵니다. 이때 무엇을 선택해야 하나요? 어떻게 하면 강사선생님처럼 Run Without Debugging을 실행할 수 있나요? 참고로 오른쪽 상단의 오른쪽 방향 세모 아이콘을 클릭하면 문제없이 실행하고 Hello python!이 출력됩니다. (저는 단축키 설정에 대해서 질문을 드린 게 아닙니다.)
defoogle
2024-03-17T05:04:33.760Z
댓글 2
좋아요 0
조회수 619
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 Count, PlusButton이 re render 되는 조건을 알고 싶습니다. 예전예시에서는 class Consumer extends React.Component { constructor(props) { super(props); this.state = { value: emitter.get(), }; this.setValue = this.setValue.bind(this); } setValue(nextValue) { this.setState({ value: nextValue }); } componentDidMount() { emitter.on(this.setValue); } componentWillUnmount() { emitter.off(this.setValue); } render() { return <>{this.props.children(this.state.value)}</>; } } Consumer가 state를 가지고 있음으로 순서가 Provider render -> Consumer render -> Consumer componentDidMount -> Provider componentDidMount (set 을 통해 빈 객체였던 것을 value, setValue로 바꿔줌) 이때 Consumer state는 emitter.get()임으로 변경된 것을 감지 하고 re render 하는 것으로 이해했었습니다. 헌데 이번예시에서는 function useContext(context) { console.log("userContext, context.emitter.get() = ", context.emitter.get()); const [value, setValue] = React.useState(context.emitter.get()); React.useEffect(() => { console.log("Consumer useEffect"); context.emitter.on(setValue); return () => { console.log("Consumer useEffect clean"); context.emitter.off(setValue); }; }, [context]); return value; } const Count = () => { console.log("Count render"); const { count } = MyReact.useContext(countContext); return <div>{count}</div>; }; Provider render -> Count(Consumer) render -> Count's useEffect -> Provider's useEffect 을 통해 emitter 값이 빈객체에서 count, setCount로 채워지는것은 이해하였습니다. 이때 Count 가 다시 한번 re render되는데 왜 그런 것인가요? 첫번째 예시처럼 state?같은게 존재하는건가요? 다시 render되는 조건이 궁금합니다.
react React-Context react-hooks react-router react-component
dohyun_lim
2024-03-16T07:29:28.285Z
댓글 2
좋아요 1
조회수 459
미해결
[리뉴얼] 파이썬입문과 크롤링기초 부트캠프 [파이썬, 웹, 데이터 이해 기본까지] (업데이트)
안녕하세요 복습은 어떤식으로 하면 되나요
닉네임을 등록해주세요
2024-03-14T12:05:34.343Z
댓글 1
좋아요 0
조회수 258
미해결
[리뉴얼] 파이썬입문과 크롤링기초 부트캠프 [파이썬, 웹, 데이터 이해 기본까지] (업데이트)
- 본 강의 영상 학습 관련 문의에 대해 답변을 드립니다. (어떤 챕터 몇분 몇초를 꼭 기재부탁드립니다) - 이외의 문의등은 평생강의이므로 양해를 부탁드립니다 - 현업과 병행하는 관계로 주말/휴가 제외 최대한 3일내로 답변을 드리려 노력하고 있습니다 - 잠깐! 인프런 서비스 운영(다운로드 방법포함) 관련 문의는 1:1 문의하기를 이용해주세요. 포스트맨 구성이 달라져서 블로그 보고 따라해봐서 성공했습니다 업데이트 되어 달라진 것 같아서, 다른 분들도 참고하실 수 있게 강의 내용도 업데이트 되거나 게시판에 업로드 해주시면 좋을 거 같습니다-
juhyun2393
2024-03-13T07:25:52.964Z
댓글 2
좋아요 2
조회수 444
미해결
[React 2부] 고급 주제와 훅
OrderPage/index.jsx 생성자(constructor)의 state 부문에서 this.state = {order: null,} 와 this.state = {}의 차이가 있나요?(this.state = {order: null,} 로 선언한 이유가 궁금합니다. )
react React-Context react-hooks react-router react-component
오동엽
2024-03-12T08:00:28.927Z
댓글 1
좋아요 1
조회수 269
미해결
프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
rokoppa@gmail.com 입니다. 감사합니다~!
2024-03-10T07:01:24.061Z
댓글 1
좋아요 0
조회수 223
미해결
프로그래밍 시작하기 : 파이썬 입문 (Inflearn Original)
안녕하세요. F5나 Ctrl+F5를 누르면 코드를 실행하지 않고 첨부한 캡쳐처럼 Select debugger 라고 뜹니다. 그리고 오른쪽의 세모를 클릭하면 실행합니다. 강의대로 그대로 따라했는데 제가 무언가 빠뜨린 게 있는 건가요? 어떻게 해야하죠? 감사합니다!
defoogle
2024-03-08T03:13:07.033Z
댓글 3
좋아요 0
조회수 2267
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 혼자 해보는 과정중에 질문이 있습니다. import React from "react"; import Backdrop from "../components/Backdrop"; import Dialog from "../components/Dialog"; export const layoutContext = React.createContext({}); layoutContext.displayName = "LayoutContext"; export class Layout extends React.Component { constructor(props) { super(props); this.state = { dialog: null, }; this.setDialog = this.setDialog.bind(this); } setDialog(dialog) { this.setState({ dialog }); } render() { const value = { dialog: this.state.dialog, setDialog: this.setDialog, }; return ( <layoutContext.Provider value={value}> {this.props.children} </layoutContext.Provider> ); } } export const DialogContainer = () => ( <layoutContext.Consumer> {({ dialog }) => dialog && <Backdrop>{dialog}</Backdrop>} </layoutContext.Consumer> ); export const withLayout = (WrappedComponent) => { const WithLayout = (props) => ( <layoutContext.Consumer> {({ dialog, setDialog }) => { const openDialog = () => { console.log("openDialog") setDialog(<Dialog>hihi</Dialog>); }; const closeDialog = () => { setDialog(null); }; const enhancedProps = { openDialog, closeDialog, }; return ( <WrappedComponent {...props} {...enhancedProps}></WrappedComponent> ); }} </layoutContext.Consumer> ); return WithLayout; }; withLayout을 만들어서 openDialog, closeDialog를 enhancedProps로 전달을 하였습니다. import * as MyLayout from "../lib/MyLayout"; const Page = ({ header, children, footer, openDialog }) => ( <div className="Page"> <header>{header}</header> <main>{children}</main> <footer>{footer}</footer> <MyLayout.DialogContainer /> <button onClick={openDialog}>dialog</button> </div> ); export default MyLayout.withLayout(Page); Page에서 MyLayout.DialogContainer이 기본값이 null인데 button을 추가하여 고차컴포넌트에서 주입받은 openDialog를 사용하여 Dialog를 렌더링하는데 성공하였습니다. 닫기도 해보고싶어서 import * as MyLayout from "../lib/MyLayout"; const Dialog = ({ closeDialog }) => ( <div className="Dialog"> <header>header</header> <main>main</main> <footer>footer</footer> <button onClick={closeDialog}>closeDialog</button> </div> ); export default MyLayout.withLayout(Dialog); Dialog component에 닫기 버튼을 추가하려고 MyLayout.withLayout으로 감싸니 초기화 전에 참조하려 했다는데 이 에러 자체는 이해가 가지만 왜 지금 위 상황이 이 에러에 해당되는 상황인지 이해가 가지 않습니다...
react React-Context react-hooks react-router react-component
dohyun_lim
2024-03-08T01:28:12.351Z
댓글 1
좋아요 1
조회수 297
미해결
실습으로 끝장내는 웹 크롤링과 웹 페이지 자동화 & 실전 활용
안녕하세요 선생님 강의 듣고 있는 이광희라고 합니다. 올려주신 강의로 텔레그램 자체 API를 써서 메세지 전송하기까진 했는데요 이미지를 전송하려고 보니 거의 모든 블로그, 유튜브 설명들이 파이썬 텔레그램봇으로 설명 하더라구요 근데 이 봇이 v20으로 바뀌면서 비동기 프로그래밍(?)이 된거 같습니다. 설명하고 있는 코드들이 다 과거 버전 코드들이네요. 그래서 위키에 직접 가서 코드를 보고 있는데요 import asyncio import telegram async def main(): bot = telegram.Bot("TOKEN") async with bot: print(await bot.get_me()) if __name__ == '__main__': asyncio.run(main()) 그냥 위키에 나오는 간단한 코드인데도 RuntimeError: asyncio.run() cannot be called from a running event loop 이런 에러가 계속 뜹니다. async 부터 공부하려고 다른 유튜브를 찾아서 import asyncio async def main(): await asyncio.sleep(1) print('hello') asyncio.run(main()) 이런 간단한 코드를 입력해도 똑같은 오류가 뜨네요... 이벤트 메인 루프가 실행되고 있는 동안에 함수가 작동할수 없다 그런 내용인거 같은데 위키에 있는 그대로 따라해도 에러가 나니 비전공자 입장에서는 어떻게 해야 좋을지 모르겠네요. 경영학과 출신 직장인이 실무에서 쓰려고 파이썬을 배우고 있는데 물어볼곳이 여기밖에 없어 여쭤봅니다ㅠㅠ 좀 도와주세요 깃헙? 말고 국내 파이썬 qna있는 커뮤니티라도 알려주시면 가서 좀 물어보고 싶은데 그게 어디인지도 모르겠네요.
python 웹-크롤링 selenium beautifulsoup
Kwanghee Lee
2024-03-02T11:31:13.076Z
댓글 4
좋아요 0
조회수 3997
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 react context를 이해하려고 시도하는 중입니다. const countContext = MyReact.createContext({ count: 0, setCount: () => {}, }); class CountProvider extends React.Component { constructor(props) { console.log("CountProvider construtor"); super(props); this.state = { count: 0, }; } render() { const value = { count: this.state.count, setCount: (nextValue) => this.setState({ count: nextValue }), }; return ( <countContext.Provider value={value}> {this.props.children} </countContext.Provider> ); } } const Count = () => { return ( <countContext.Consumer> {(value) => { console.log("CountComponent", value); return <div>{value.count}</div>; }} </countContext.Consumer> ); }; const PlusButton = () => { return ( <countContext.Consumer> {(value) => { console.log("PlustButtonComponent", value); return ( <button onClick={() => value.setCount(value.count + 1)}> + 카운트 올리기 </button> ); }} </countContext.Consumer> ); }; export default () => ( <CountProvider> <Count /> <PlusButton /> </CountProvider> ); Count , Plus Button component return 문에 각각 console.log("CountComponent", value); console.log("PlustButtonComponent", value); 로그를 남겨봤습니다. 사진에 표시 된 것 처럼 로그가 각 Component마다 2번씩 찍히는데 그 이유를 알 수 있을까요...? 로그의 value 값이 다른게 힌트 같은데 해석을 하지 못하겠습니다.
react React-Context react-hooks react-router react-component
dohyun_lim
2024-03-01T06:35:57.523Z
댓글 2
좋아요 1
조회수 451
해결됨
[퇴근후딴짓] 빅데이터 분석기사 실기 (작업형1,2,3)
안녕하십니까? 결측값 채우기 중 최빈값 관련해서,, m = X_train['workclass'].mode()[0] 여기서 mode()과 mode()[0]의 차이는 무엇인지요? 즉 [0]의 쓰임이 무엇인지? 다른 중앙값, 평균 등은 이런게 없는데 왜 최빈값만 이런게 뒤에 붙는지요?
python 머신러닝 빅데이터 pandas 빅데이터분석기사
kccjjang
2024-02-29T05:03:13.126Z
댓글 2
좋아요 0
조회수 257
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 Ref를 알아보는 과정에서 import React from "react"; import CartPage from "./pages/CartPage"; import OrderPage from "./pages/OrderPage"; import ProductPage from "./pages/ProductPage"; const App = () => ( <> {/* <ProductPage /> */} {/* <OrderPage /> */} <CartPage /> </> ); // export default App; class MyComponent extends React.Component { divRef = React.createRef(); render() { return ( <div ref={this.divRef}> </div> ) } componentDidMount() { console.log(this.divRef) } } export default MyComponent 이렇게 MyComponent가 export 되었길레 import React from "react"; import ReactDOM from "react-dom/client"; import App from "./App"; import MyComponent from "./App"; const { worker } = require("../../shared/mocks/browser"); worker.start({ onUnhandledRequest: "bypass", }); const root = ReactDOM.createRoot(document.getElementById("root")); root.render(<App />); // root.render(<MyComponent />); main.js에서 root.render를 변경해야될줄 알았는데 변경을 하지 않아도 정상동작을 하는데 이것은 왜 그런것인가요?
react React-Context react-hooks react-router react-component
dohyun_lim
2024-02-28T05:14:12.935Z
댓글 1
좋아요 1
조회수 211
해결됨
[React 2부] 고급 주제와 훅
안녕하세요 선생님 질문이 있습니다. <Button whatelse={"will"}>주문하기 , 결제하기</Button> --- const Button = ({ whatelse }) => ( <button className="Button brand">{whatelse}</button> ); export default Button; children처럼 제가 따로 설정해주지도 않았는데 기본적으로 생성된 props들은 뭐라고 부르나요? const Button = ({ styleType, block, ...rest }) => { let className = "Button"; if (styleType) className += ` ${styleType}`; if (block) className += ` block`; return <button className={className} {...rest}></button>; }; export default Button; 또한 강의 후반에 ...rest로 children, onClick props 를 퉁치는데 이떄 children props 내용이 return하는 button element에 {children} 이렇게 들어있지 않아도 잘 렌더링이 되던데 이것은 뭐라 부르나요?
react React-Context react-hooks react-router react-component
dohyun_lim
2024-02-22T05:39:07.824Z
댓글 2
좋아요 1
조회수 422
미해결
파이썬으로 뭘 만들지? 남박사의 파이썬 알쓸파잡
안녕하세요. 선생님 수업을 통해 크롤링까지는 성공했습니다. HTTP POST 요청으로 받아왔는데요. 다만 Response가 넥사크로에서 사용하는 "SSV"형식으로 왔습니다. SSV:UTF-8ErrorCode:string=0ErrorMsg:string=Dataset:ds_PageList_RowType_TAXNO:string(255)TAXIDX:string(255)MEMBNAM:string(255)TSDATE:string(255)TSTIME:string(255)ACQBID:string(255)CARD_NAME:string(255)HID:string(255)ACQHID:string(255)TERMID:string(255)MTRCNO:string(255)CDNO:string(255)AUTHNO:string(255)ISTMMON:string(255)CURRCODE:string(255)AMT1:bigdecimal(25)AMT2:bigdecimal(25)AMT3:bigdecimal(25)ACQDATE:string(255)DDCEDI:string(255)...... <생략> 이렇게 못생긴 데이터가 왔는데요. 이걸 json으로 파싱하고싶어서요. 이리저리 혼자서 아스키코드 찾아보고 US, RS 사용해서 어떻게든 파싱은 했는데, 제가 짠 로직이 맞나 싶어서요. (일단 작동은 되는데.. ) 혹시 선생님이라면 어떻게 하실까 싶어서요. 이런걸 잘 파싱하려면 알고리즘을 공부해야되는걸까요? 아! 그리고 깃헙에 혹시 라이브러리가 있나 찾아봤는데요. 안나오더라구요. 이게 제일 슬펐어요. 그나저나 저런거 만드는 사람들은 정말 괴물같네요.. 저런걸 도대체 어떻게 만드는 걸까요? (코드가 본문에 저렇게 붙여넣어지는 기능도 신기하네요.. 저런건 또 어떻게 만드나요?)
포포
2024-02-22T02:44:52.833Z
댓글 2
좋아요 0
조회수 846
미해결
기초 알고리즘 코딩테스트 40일 완성 (by 하루코딩)
최댓값 문제 2566번인데 2556번(별 찍기 - 14)로 숫자가 잘못되어있습니다. 수정 부탁드립니다.
kairs294702
2024-02-19T10:20:10.561Z
댓글 2
좋아요 0
조회수 292
미해결
장고 설계철학으로 시작하는 파이썬 장고 입문
화면과같이 include 부분 강좌와 다르게 저절로 세팅이 되고 서버 실행하면 계속 오류가나는데 어떻게해야하나요ㅜㅜ
동휘김
2024-02-12T05:12:30.040Z
댓글 2
좋아요 0
조회수 260
미해결
React Router 완전 정복
안녕하세요. action 과 Form 을 이용해서 submit 처리하기 강의 중 submit 버튼 클릭 시 preventDefault() 작성하는 부분이 없어서 페이지가 새로고침 되던데 강의에서는 새로고침이 안되고 있네요 이유를 알 수 있을까요?
react spa react-router react-router-dom
tessjds
2024-02-10T07:15:48.445Z
댓글 1
좋아요 0
조회수 327
해결됨
5분빨리 퇴근하자! 파이썬 데이터 분석, 시각화, 웹 대시보드 제작하기
버튼과 체크박스 모두 조건문을 사용할 때는 바로 아래에 텍스트가 출력되는데, 함수를 사용하면 대시보드 맨 위에 텍스트가 호출되는 것은 왜 그런건가요?(맨 위에 텍스트가 호출되어 출력된 부분이 전부 다 한 칸 씩 밀리게 됨)
python pandas seaborn plotly matplotlib data-visualization streamlit
TEW_교육관리자
2024-02-06T04:07:09.708Z
댓글 1
좋아요 0
조회수 329
해결됨
코딩테스트 [ ALL IN ONE ]
글에 두서가 없어도 양해 바랍니다 이 수업 수강 이전에 코딩 문제를 풀 때 파이썬으로 재귀함수를 사용했던 적이 있습니다. 그때 알게 된것이 파이썬의 재귀함수에는 기본적으로 깊이의 제한이 있다는 것입니다. sys.recursionlimit()으로 확인해보니 재귀호출을 1000이상 못하도록 값이 제한되어 있고 이 값을 늘려서 사용하는것은 별로 추천되는 방법이 아닌걸로 알고 있습니다. C언어 사용할때에는 속도면에서 제한도 없고 파이썬보다 속도도 월등하다보니 재귀를 자주 사용했었는데 파이썬에서 재귀함수로 풀어야 하는 경우가 있을까요?
2024-02-02T12:57:10.023Z
댓글 2
좋아요 1
조회수 361