quote.js
// Fetches the quote list, converts in json format and allocates to 'allQuotes' state obj
Fetches the quote list, converts in json format and allocates to 'allQuotes' state obj
Fetches the quote list converts in json format and allocates to ' allQuotes ' state obj
componentWillMount() {
    fetch("https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json")
      .then(res => res.json())
      .then(data => this.setState({ allQuotes: data.quotes, randomQuote: data.quotes[Math.floor(Math.random() * data.quotes.length)] }))
      .catch(err => console.log('This is error', err));
  }
componentWillMount ( ) { fetch ( "https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json" ) . then ( res => res . json ( ) ) . then ( data => this . setState ( { allQuotes : data . quotes , randomQuote : data . quotes [ Math . floor ( Math . random ( ) * data . quotes . length ) ] } ) ) . catch ( err => console . log ( 'This is error' , err ) ) ; }
Fetches the quote list, converts in json format and allocates to 'allQuotes' state obj
Fetches the quote list converts in json format and allocates to ' allQuotes ' state obj