Challenge: Remember Last Searches
Try coding to remember last five searches to hit the API.
We'll cover the following
Task
Remember the last five search terms to hit the API, and provide a button to move quickly between searches. When the buttons are clicked, stories for the search term are fetched again.
Optional Hints:
- Don’t use a new state for this feature. Instead, reuse the
url
state andsetUrl
state updater function to fetch stories from the API. Adapt them to multipleurls
as state, and to set multipleurls
withsetUrls
. The last URL fromurls
can be used to fetch the data, and the last five URLs fromurls
can be used to display the buttons.
Get hands-on with 1400+ tech skills courses.