How to store a twitter API response in react and use on later in components

  • 0
  • Pump00:00

I need help in saving a response from Twitter API and then use it later on in parent component, eventually pass it down as props to children components in a React project. I am using a package called twitter that uses acquired credentials for the call.

var Twitter = require('twitter');

var client = new Twitter({
    consumerKey: "",
    consumerSecret: "",
    bearer_token: '',
    port: ""
});

client.get('statuses/user_timeline', function(error, tweets, response) {
    if(error) throw error;
    console.log(tweets);  // The favorites.
    console.log(response);  // Raw response object.
}); 
Default Asked on February 7, 2020 in No Category.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.