Answers for "react fetech"

3

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))
  }
Posted by: Guest on July-21-2020
0

react native anination 2 valuse

Animated.parallel([
    Animated.timing(this.state.opacity, {
        toValue: 0,
        duration: 300
    }),
    Animated.timing(this.state.height, {
        toValue: 0,
        duration: 300
    })
]).start(() => {
    // callback
});
Posted by: Guest on April-05-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language