Skip to content

Commit

Permalink
🐛 Avoid character duplication in example
Browse files Browse the repository at this point in the history
  • Loading branch information
frinyvonnick committed Jan 13, 2020
1 parent 1df7044 commit 2ab85ec
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ function useStarWarsCharacters() {
fetch(nextCharactersUrl)
.then(res => res.json())
.then(({ next, results }) => {
setCharacters([...characters, ...results])
setNextCharactersUrl(next)
if (characters.some(char => char.name === results[0].name)) return
setCharacters([...characters, ...results])
})
}

Expand Down

0 comments on commit 2ab85ec

Please sign in to comment.