I am trying to make a basic React project and I thought I was doing everything right until I tried to import my generalInput file into my App file. I am being told that my generalInput is being declared but never read. I even put my code into AI to see if I could get help but it was confused as well.
Here is the code:
import generalInput from "./generalInput";
import "./styles.css";
export default function App() {
return (
<>
<generalInput name="John" />
</>
);}
export default function generalInput(name) {
return (
<>
<label>{name}</label>
<input type="text" />
</>
);
}
2
Answers
maybe you need to reread React docs or
?X
compilersjsx
,tsx
never accept a component whose first character is number or lowercase please capitalize first letter like like this otherwise it will be treated as regular html tagThe first and basic thing is that when you create a component the first letter of its name should be capital
here is your updated component
Hope this will fix your issue