Created
          April 20, 2022 00:59 
        
      - 
      
- 
        Save stevedylandev/be3a500f5f6094e20ff94866c945b224 to your computer and use it in GitHub Desktop. 
    Aerial Component
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import { useState, useEffect } from "react" | |
| import axios from "axios" | |
| const Aerial = () => { | |
| const [emissionsData, setEmissionsData] = useState([]) | |
| const [isLoading, setIsLoading] = useState(false) | |
| const getEmissionsData = async () => { | |
| try{ | |
| setIsLoading(true) | |
| const response = await axios.get("https://aerial.is/_nft/0x2acab3dea77832c09420663b0e1cb386031ba17b") | |
| console.log(response.data) | |
| setEmissionsData(response.data) | |
| setIsLoading(false) | |
| } catch (error) { | |
| console.log(error) | |
| } | |
| } | |
| const loading = () => ( | |
| <div className="loading-container"> | |
| <h1>Loading</h1> | |
| </div> | |
| ) | |
| const emissionsComponent = () => { | |
| return ( | |
| <div className="data-container"> | |
| <h1>Data goes here</h1> | |
| </div> | |
| ) | |
| } | |
| useEffect(()=> { | |
| getEmissionsData() | |
| }, []) | |
| return ( | |
| <div className="aerial-container"> | |
| {isLoading ? loading() : emissionsComponent()} | |
| </div> | |
| ) | |
| } | |
| export default Aerial; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment