react-twitter-embed
react-twitter-embed copied to clipboard
TwitterShareButton url prop not working properly
Hi all,
I've run into two issues with the TwitterShareButton:
Condition:
- Set a different URL to the TwitterShareButton Expected behavior:
- This different URL should appear at the twitter post Found behavior:
- The post shows the current url the button is at
Condition:
- URL of TwitterShareButton is set as empty or null Expected behavior:
- No URL should appear at the twitter post Found behavior:
- The post shows the current url the button is at
Code as follows:
` import React from "react"; import {TwitterShareButton} from "react-twitter-embed"; import s from "./twitterTweet.scss";
const TwiterTweet: React.FC<ITwit> = ({ text, url, author, buttonSize = "large" }) => { return ( <div className={s.tweetButton}> <TwitterShareButton url={url} options={{ text: text, via: author, size: buttonSize }} placeholder="Loading" /> ); };
export default TwiterTweet; `
@lucianourgal on version 4.0.4?
To avoid re-rendering it was never added even in the previous version (https://github.com/saurabhnemade/react-twitter-embed/blob/example-updated/src/components/TwitterShareButton.js). However if you are still trying to achieve this, you can try like following by adding key:
https://codesandbox.io/s/jolly-wood-is0zk?file=/src/TwiterTweet.js
Thanks for replying @saurabhnemade . I'm actually using v4.0.6.