Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 32 additions & 2 deletions src/App.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
import React, { useState, useEffect } from 'react';
import './App.css';


function App() {
return <>Super Hero App</>;
const [superhero, setSuperhero] = useState({});
useEffect(()=>{
fetch('https://superheroapi.com/api.php/266500779619820/332')
.then((response) => response.json())
.then((data) => {
setSuperhero(data)
})},[])
return (
<div className="container">
<h1 className="superhero-name">{superhero.name}</h1>
<p className="superhero-id">ID: {superhero.id}</p>
<div className="superhero-image">
<img src={superhero.image} alt={superhero.name} />
</div>

<div className="superhero-features">
<h2>More Features</h2>
<ul>
<li><strong>Gender:</strong> {superhero.appearance.gender}</li>
<li><strong>Alignment:</strong> {superhero.biography.alignment}</li>
<li><strong>Occupation:</strong> {superhero.work.occupation}</li>
<li><strong>Place of Birth:</strong> {superhero.biography.placeOfBirth}</li>

</ul>
</div>
</div>
);
}

export default App;
export default App;