Hello,
for some reason, my React code won’t compile. The error code I get says that the component is not defined inside itself. Here are the code and what I get as an error:
Main.js
import React from "react"
import {DataProvider} from "./Data"
import Item from "./Item"
function Main(){
return(
<main>
<DataProvider>
<Item />
</DataProvider>
</main>
)
}
export default Main
src\Main.js
Line 14:16: 'Main' is not defined no-undeff
UPDATE: I solved this by myself, it turns out that <main> tag was causing issues so I replaced it with <div> and now it works just fine
The error message doesn’t seem like something you would get from issues in the JSX.
Looking at the line numbers it looks like the export is triggering it and the no-undef is specifically pointing to the identifier Main as the issue. Sometimes restarting create-react-app can fix oddities.