Skip to content

chapter 8: repository menu carousel #163

@stardvst

Description

@stardvst

when the entered user has no public repos, the following error is printed:

Cannot read properties of undefined (reading 'name')

i fixed RepoMenu.js with the following code. if you know better way to destructure the array, please suggest.

  const [repo, previous, next] = useIterator({ items: repos });
  const name = repo?.name;

also notice, you need to pass useIterator({ items: repos }) instead of useIterator(repos) (useIterator receives a prop named items).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions