Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Building a Search Feature

Sheriff LaFlare
Sheriff LaFlare
14,251 Points

Ran into a 429 error when following this demo, seems like it may need to be updated?

(doing this in Apr 2020) -- I ran into a 429 Too Many Requests error when implementing this step of the process. I'm wondering if this is React-related or just a byproduct of the API

3 Answers

I've found it depends on what exactly you search for. There is only 1 cat gif but 13 dog gifs... so limiting it to 12 and searching for 'dogs' returns better results... because dogs are better.

Trevor Maltbie
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Trevor Maltbie
Full Stack JavaScript Techdegree Graduate 17,020 Points

I did not have any problems.

performSearch = (query) => {
    axios.get(`http://api.giphy.com/v1/gifs/search?q=${query}&limit=24&api_key=dc6zaTOxFJmzC`)
      .then(response => {
        this.setState({
          gifs: response.data.data
        });
      })
      .catch(error => {
        console.log('Error fetching and parsing data', error);
      })
  }