Programming language/Reactjs

'React' must be in scope when using JSX 에러??

hello-world 2022. 8. 24. 15:49
728x90
반응형

React + Typescript Error 사항들

 

1.  'React' must be in scope when using JSX  react/react-in-jsx-scope

 

React를 import 해서 쓸 일이 없는 코드라고 할 지라도 확장자가 .tsx 이고

또 컴포넌트 태그를 리턴하거나 하면 반드시 상단에

import React from 'react';

라고 선언해 두어야 한다.  React 를 import 해두지 않으면 babel은 JSX를 구문 분석하고 JavaScript로 변환하는 방법을 알지 못하기 때문이다. 

 

https://stackoverflow.com/questions/56562685/react-must-be-in-scope-when-using-jsx-error-in-routes-js-file

 

'React' must be in scope when using JSX error in routes.js file

ESlint is showing me the above-mentioned error when writing a routes.js file. module.exports = { 'env': { 'browser': true, 'es6': true }, 'extends': ['plugin:react/recommended', 'sta...

stackoverflow.com

 

728x90
반응형