search

Home  >  Q&A  >  body text

Problems with creating components using react

I did have some issues, I created a React project and then another .jsx for my component, but when I added it to "app.jsx" it didn't work, I saw 'header' is declared, but its value is never read. ts(6133)' This is the code for APP.JSX

import './App.css'
import header from './header.jsx';
function App() {

  return (
    <div className="App">
      <header/>
    </div>
  )
}
export default App

Here is the code HEADER.JSX

function header() {
    return (  
<div className='header'>
</div>
    );
}
export default header;```
ı just want to connect app.jsx and header.jsx

P粉762730205P粉762730205441 days ago553

reply all(1)I'll reply

  • P粉052724364

    P粉0527243642023-09-17 10:05:55

    Rename component header to Header, just like in React, components start with a capital letter. https://pusher .com/blog/troubleshoot-react-errors/#not-starting-component-names-with-a-capital-letter

    reply
    0
  • Cancelreply