0

I am using Twitter's timeline widget with posts limit attribute in my React App. But I get all the posts. Until recently, everything worked. Maybe something has changed in the way the widget or attribute is connected?

function TwitterWidget(props: Props) {
   const { profileName } = props;

   const twitterLink = `https://twitter.com/${profileName}`

   useEffect(() => {
      const script = document.createElement('script');
      script.src = 'https://platform.twitter.com/widgets.js';
      document.getElementsByClassName('twitter-embed')[0].appendChild(script);
   }, []);

   return (
      <WidgetWrapper>
         <section className='twitterContainer'>
            <div className='twitter-embed'>
               <a
                  className='twitter-timeline'
                  data-tweet-limit='2'
                  href={twitterLink}
               >
                  {`Tweets by ${profileName}`}
               </a>
            </div>
         </section>
      </WidgetWrapper>
   );
};

0 Answers0