Skip to content

done #266

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

done #266

Show file tree
Hide file tree
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
32 changes: 21 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.3",
"@testing-library/user-event": "^13.5.0",
"axios": "^0.26.0",
"axios": "^0.26.1",
"msw": "^0.38.2",
"mutationobserver-shim": "^0.3.7",
"react": "^17.0.2",
Expand Down
22 changes: 21 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
import React from 'react';

import { useState, useEffect } from 'react';
import axios from 'axios';
import Character from './components/Character'
const App = () => {

const [characters,setCharacters] = useState([])
useEffect(() => {
axios.get(`https://swapi.dev/api/people/`)
.then(res=> {
console.log(res.data)
setCharacters(res.data)
})
.catch(err => console.log(err))
}, [])



// Try to think through what state you'll need for this app before starting. Then build out
// the state properties here.

Expand All @@ -9,8 +24,13 @@ const App = () => {
// sync up with, if any.

return (

<div className="App">

<h1 className="Header">Characters</h1>
{characters.map(char => {
return <Character name={char.name} />
})}
</div>
);
}
Expand Down
12 changes: 12 additions & 0 deletions src/components/Character.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// Write your Character component here
import React from 'react'

function Character(props) {
return (
<div>
<h2>{props.name}</h2>
<button> Click to know more </button>
</div>
)
}

export default Character
9 changes: 9 additions & 0 deletions src/components/Details.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import React from 'react'

function Details() {
return (
<div>Details</div>
)
}

export default Details