I have this simple React code but is not importing properly, I don’t know why.
import teste from './components/teste';
import './App.css';
function App() {
return (
<Container>
<teste/>
</Container>
);
}
const Container = styled.div`
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100%;
background: blue;
`
export default App;
also have the teste component
import React from 'react'
export default function teste() {
return (
<div>teste</div>
)
}
2
Answers
The name of components needs to start with a capital letter, otherwise they are not considered as components by React. Try to rename your component to
Test
and it should work.`const Container = styled.div“ looks like styled components syntax.
Is the styled-components package installed?
Try removing the styled component syntax and use plain jsx instead.