CMD에서 npm start나 yarn start로 React Client를 실행시켰을 때,
제목과 같이 TypeError: Cannot read property 'createElement' of undefined 오류를 볼 수 있는 경우가 있다.
이와 같은 문제가 일어난 이유는, import { React, useState } from 'react'; 와 같이 import가 제대로 되어 있지 않기 때문.
Googling을 해보면 import * as React from 'react'; 로 해결하는 법이 있는데, 정확하게 해결하는 방법은 아래와 같다.
import { React, useState } from 'react'; => import React, { useState } from 'react'로 바꾸면 정상적으로 동작한다.
반응형
'Web > Error Report' 카테고리의 다른 글
[React] React Router의 BrowserRouter에서 history.push후 Render 문제 (0) | 2021.08.15 |
---|---|
[React] history 버전 문제로 history.push후 Render 문제 (0) | 2021.08.15 |
[React] Warning: A component is changing an uncontrolled input to be controlled (0) | 2021.08.12 |