Skip to content

Complete homework.#11

Open
dgallinger wants to merge 1 commit into
frontend-application-development-uw20:masterfrom
dgallinger:master
Open

Complete homework.#11
dgallinger wants to merge 1 commit into
frontend-application-development-uw20:masterfrom
dgallinger:master

Conversation

@dgallinger
Copy link
Copy Markdown

Week 5 HW Submission

Please fill out the information below in order to complete your assignment. Feel free to update this comment later if necessary.

  • Comfort rating on this assignment (1-5): 1|2|3|4|5
  • Completion rating on this assignment: complete|incomplete

<div>
<h1 className="header">Star Wars Characters</h1>
<ul>
{this.state.people.map((person, id) => (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This happens to work since the API's IDs are sequential. Another way you can grab the id is to parse the url in each character object. e.g. person.url.split('/'), then retrieve the last value in the array.

state = {details: {} };

componentDidMount() {
const { id } = this.props.match.params;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also use const {id} = useParams() here too if you'd like

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants