inflearn logo
강의

Khóa học

Chia sẻ kiến thức

Tạo NodeBird SNS bằng React

6-3. Nhận dữ liệu máy chủ với getInitialProps

6-3 강좌 따라 코딩중인데요 질문드립니다

Đã giải quyết

566

baek22h3104

1 câu hỏi đã được viết

0

안녕하세요, 6-3 강좌 따라 코딩중인데요 

아래와 같은 에러로 다음강좌로 못넘어가고 있습니다

도와주세요 ㅠㅠ

 
ypeError: Cannot read property 'getInitialProps' of undefined
_callee$
./pages/_app.js:34
31 | pageProps: PropTypes.object.isRequired,
32 | };
33 |
> 34 | NodeBird.getInitialProps = async (context) => {
35 | console.log('getInitialProps is running!!!!');
36 |
37 | // console.log(context);
Function.getInitialProps
./pages/_app.js:34
31 | pageProps: PropTypes.object.isRequired,
32 | };
33 |
> 34 | NodeBird.getInitialProps = async (context) => {
35 | console.log('getInitialProps is running!!!!');
36 |
37 | // console.log(context);
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.

react javascript

Câu trả lời 3

0

zerocho

네네 그래서 나중에 오타를 잡기 위해 typescript를 사용하거나, 좋은 IDE의 도움을 받습니다.

0

baek22h3104

찾았습니다. 오타가 있었네요 ㅠㅠ

Context 에서 구조분해 할때는 componet 라고 받고

실제 사용할때는 component라고 했네요 

java 할때는 ide단이나 컴파일 단에서 이러한 오타 다 잡아줬었는데

javascript는 이런부분에서 너무 힘드네요 일일이 다찾아야 하다니 ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

그래도 SI 천지이 java 에서 벗어나야겠네요 ㅠㅠㅠㅠ

강좌너무 잘보고있습니다

0

baek22h3104

참고로 front쪽 에 남김 로그입니다.

 

 

getInitialProps is running!!!!

getInitialProps is running!!!!

getInitialProps is running!!!!

getInitialProps is running!!!!

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/regenerator-runtime/runtime.js 404 873.954 ms - 5913

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/.next/server/static/development/pages/_app.js 404 871.974 ms - 5913

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/core-js/library/modules/_export.js 404 869.771 ms - 5913

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/next-redux-wrapper/lib/index.js 404 867.896 ms - 5913

GET /_next/webpack-hmr?page=/ 200 0.921 ms - -

[ ready ] compiled successfully

GET /_next/static/webpack/db8988c399e5bddd2fa1.hot-update.json 200 577.148 ms - 35

getInitialProps is running!!!!

GET / 200 13.344 ms - 6115

GET /_next/static/runtime/webpack.js?ts=1564019786869 200 3.240 ms - 34960

GET /_next/static/runtime/main.js?ts=1564019786869 200 3.507 ms - 836522

GET /_next/static/development/dll/dll_92fa9139568d8c3d8f78.js?ts=1564019786869 200 2.086 ms - 901660

GET /_next/static/runtime/webpack.js.map 200 2.725 ms - 36238

GET /_next/static/development/dll/dll_92fa9139568d8c3d8f78.js.map 200 3.117 ms - 1046210

GET /_next/static/chunks/0.js 200 0.693 ms - 440

GET /_next/static/chunks/0.js.map 200 3.652 ms - 99

GET /_next/static/development/pages/index.js.map 200 1635.243 ms - 6084792

GET /_next/static/runtime/main.js.map 200 7.001 ms - 754571

GET /_next/static/development/pages/_app.js?ts=1564019786869 200 1.490 ms - 6866105

GET /_next/static/development/pages/index.js?ts=1564019786869 200 529.743 ms - 6678210

GET /_next/static/development/pages/_app.js.map 200 0.927 ms - 6238781

GET /_next/development/server/static/development/pages/_app.js 200 3.697 ms - 149266

getInitialProps is running!!!!

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/regenerator-runtime/runtime.js 404 20.418 ms - 5913

getInitialProps is running!!!!

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/.next/server/static/development/pages/_app.js 404 22.560 ms - 5913

getInitialProps is running!!!!

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/core-js/library/modules/_export.js 404 34.662 ms - 5913

getInitialProps is running!!!!

GET /Users/hoseokbaek/workspace/react/react-nodebird/front/node_modules/next-redux-wrapper/lib/index.js 404 97.201 ms - 5913

GET /_next/development/server/static/development/pages/_app.js.map 200 1.037 ms - 73383

GET /_next/static/development/pages/index.js.map 200 170.547 ms - 6084792

 

------------------------------------------------------------------------------------------------------------------

 

getInitialProps is running!!!! 이 로그가

 

NodeBird.getInitialProps = async (context) => {

함수 안에 남긴 로그인데 

보시는바와같이 처음에 계속찍히다가 404 에러와 또 함께찍히네요 ㅠㅠ

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

next 10 이상에서는 redux dev tool 구동이 안되나요?

0

316

1

세션 갱신 문의 건

0

625

7

배포 진행 후 Highlight updates components render 표시

0

515

1

똑같은 기능을 하는 테이블

0

540

4

관계형

0

369

2

프론트 서버를 이용하지 않는경우

1

355

3

인피니트 스크롤링 사용시 오류

0

311

0

계속 이런에러가 떠서 해결하기는 했는데 어떤 의미인지 모르겠습니다.

0

492

2

req.user가 언제 생성되나요??

0

385

2

Cannot read property 'id' of null 에러

0

386

1

리트윗한 게시글 불러오는 sequelize

0

298

1

result.data에서 images인 이유

0

328

2

takeLatest에 대한 질문입니다.

1

390

2

프론트에서 express를 사용하지 않을때 동적라우팅

0

572

6

getInitialProps가 클라이언트에서 수행되는 이유?

0

300

1

리로드하면 팔로우 언팔로우 값이 초기화 되는 문제입니다.

0

508

2

스타일드 컴포넌트와 className을 통한 스타일 적용의 차이에 대해 궁금합니다

0

641

2

할인 쿠폰 사용이 안되는되요 (848-f9af83f183e3)

0

397

1

nodejs mvc 패턴

0

1057

4

사용하고 보니, 람다 구성이 궁금합니다!

0

316

1

제로초님

0

476

1

새로고침 로그인 풀림 문제.

0

293

1

안녕하세요. 강의 너무 감사합니다

0

207

1

제로초님

0

207

1