1
resposta

Não roda o projeto

baixei o projeto inicial para preparar o ambiente, fiz o npm i, quando faço o "npm start"

aparece esse erro

src\pages\Cardapio\Itens\Item\index.tsx Line 10:5: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 11:7: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 12:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 14:7: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 15:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 16:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 17:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 19:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 20:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 24:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 25:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 26:11: 'React' must be in scope when using JSX react/react-in-jsx-scope

src\pages\Cardapio\Itens\index.tsx Line 45:5: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 47:9: 'React' must be in scope when using JSX react/react-in-jsx-scope

src\pages\Cardapio\index.tsx Line 14:5: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 15:7: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 16:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 18:7: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 19:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 23:7: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 24:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 25:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 26:9: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 27:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 28:11: 'React' must be in scope when using JSX react/react-in-jsx-scope Line 30:9: 'React' must be in scope when using JSX react/react-in-jsx-scope

Search for the keywords to learn more about each error.

1 resposta

Olá, Eduardo. Como vai?

O erro que você tá vendo, 'React' must be in scope when using JSX, acontece porque o React não tá sendo importado corretamente no arquivo onde você tá usando JSX. Isso é necessário em versões mais antigas do React.

Pra resolver, você pode adicionar a importação do React no topo dos arquivos.

Um exemplo de como deve ficar:

import React from 'react'; // Adicione esta linha
import './Item.css';

// O restante do seu código...

Depois disso, tente iniciar o projeto novamente com:

npm start

Espero ter ajudado!

Siga firme nos seus estudos e conte com o fórum sempre que precisar!

Abraços :)

Caso este post tenha lhe ajudado, por favor, marcar como solucionado