“Obtener reacción de solicitud” Código de respuesta

Obtener reacción de solicitud

// Simple GET request using fetch
fetch('https://api.npms.io/v2/search?q=react')
  .then(response => response.json())
  .then(data => this.setState({ data: data.feed }));
Sticky Pingu

React Get Method

/* React get method.  */

componentWillMount(){
    fetch('/getcurrencylist',
    {
        /*
        headers: {
          'Content-Type': 'application/json',
          'Accept':'application/json'
        },
        */
        method: "get",
        dataType: 'json',
    })
    .then((res) => res.json())
    .then((data) => {
      var currencyList = [];
      for(var i=0; i< data.length; i++){
        var currency = data[i];
        currencyList.push(currency);
      }
      console.log(currencyList);
      this.setState({currencyList})
      console.log(this.state.currencyList);
    })
    .catch(err => console.log(err))
  }
Enthusiastic Elephant

Respuestas similares a “Obtener reacción de solicitud”

Preguntas similares a “Obtener reacción de solicitud”

Más respuestas relacionadas con “Obtener reacción de solicitud” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código