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 and setUrl state updater function to fetch stories from the API. Adapt them to multiple urls as state, and to set multiple urls with setUrls. The last URL from urls can be used to fetch the data, and the last five URLs from urls can be used to display the buttons.

Get hands-on with 1200+ tech skills courses.