title: createError.js:16 Uncaught (in promise) Error: Request failed with status code 400
body: <blockquote>
    <p>I'm trying to get data from youtube API but get a bed request like
    this: Request failed with status code 400. below code in Youtube.js</p>
  </blockquote>
  
  <pre><code>import axios from 'axios';
  const KEY = 'AIzaSyDg1vwi_QOn6zNEaFGL8OWTGD2qWAEDnvE';
  
  export default axios.create({
     baseURL: 'https://www.googleapis.com/youtube/v3',
     params: {
        part: 'snippet',
        maxResults: 5,
        key: KEY
     }
  })
  </code></pre>
  
  <blockquote>
    <p>Then I import it in my App.js and below code in App.js</p>
  </blockquote>
  
  <pre><code>import React from 'react';
  import SearchBar from './SearchBar';
  import Youtube from '../Api/Youtube';
  
  class App extends React.Component {
  
    onSearchSubmit = async (term) =&gt; {
      const response = await Youtube.get('/search', {
        params: {
          q: term
        }
      })
  
      console.log(response)
    }
    render() {
      return (
         &lt;div className="ui container" style={{ marginTop: '20px' }}&gt;
          &lt;SearchBar Akib={this.onSearchSubmit} /&gt;
        &lt;/div&gt;
      )
    }
  }
  
  export default App;
  </code></pre>