I wrote this code and the error is showing at Header and List. It keeps saying that JSX element type Header does not have any construct ....?
import React, { useEffect, useState } from 'react';
import logo from './logo.svg';
import './App.css';
import axios from 'axios';
import { Header, List } from 'semantic-ui-react';
function App() {
const [admin, setAdmin] = useState([]);
useEffect(() => {
axios.get('http://localhost:5000/api/admin').then(response => {
console.log(response);
setAdmin(response.data);
})
}, [])
return (
<div>
<Header as='h2' icon='users' content='Reactivities'/>
<List>
{admin.map((AppUser: any) => (
<List.Item key={AppUser.id}>
{AppUser.city}
</List.Item>
))}
</List>
</div>
);
}
export default App;
I was struggling with the same error for a pretty long time. Finally, the reason for me was an incompatibility of versions. It got fixed with this combination:
"react": "^17.0.2",
"react-dom": "^17.0.2",
"semantic-ui-react": "^2.1.2"
"@types/react": "^17.0.3",
"@types/react-dom": "~17.0.3"