How to make API Call in react with wikipedia API project and Youtube API project part-1 UCS - Unleash-Coding-Skills

Saturday, 16 June 2018

How to make API Call in react with wikipedia API project and Youtube API project part-1 UCS

For beginners of learning to react their dream is to make a website using a React. So it is most useful for you to do this.

First of what is need to make an API call in react.

First, of I will give you a link to my project where you can make a react project if you have basic react concepts. At the end, the project looks like this.


You can search the videos with their name and can play them along with recommendations as shown in the above.

First, of the thing you require is make is make a youtube API call like this

import YTSearch from 'youtube-api-search';

constructor(props)
    {
        super();
        this.state={ videos:[],
        selectedVideo : null };
       
       this.videoSearch('surf Boards');
    };
    
    videoSearch(term)
    {
        YTSearch({key:API_KEY,term:term},(videos) =>
        {
       this.setState({videos:videos,selectedVideo:videos[0]},
); });


Make sure that I am using a state variable to save the API response of youtube. You need to install the API package of the youtube to go easier it can be done by installing in node modules.

"npm install --save youtube-api-search"

For complete assistance to this project you can find in the following  link:


Click Here: Video-Crawler-Project link


        
But you can also know direct API call making using react without using or installing any packages you can find the API call in the given link.

Wiki Search project to understand in detail.

Click here :Wiki-Search-Api-Project-Link

Click on above link for a more detailed explanation

No comments:

Post a comment