Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TwitterShareButton url prop not working properly #97

Open
lucianourgal opened this issue Jan 31, 2022 · 3 comments
Open

TwitterShareButton url prop not working properly #97

lucianourgal opened this issue Jan 31, 2022 · 3 comments

Comments

@lucianourgal
Copy link

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 = ({
text,
url,
author,
buttonSize = "large"
}) => {
return (


<TwitterShareButton
url={url}
options={{
text: text,
via: author,
size: buttonSize
}}
placeholder="Loading"
/>

);
};

export default TwiterTweet;
`

@saurabhnemade
Copy link
Owner

@lucianourgal on version 4.0.4?

@saurabhnemade
Copy link
Owner

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

@lucianourgal
Copy link
Author

Thanks for replying @saurabhnemade . I'm actually using v4.0.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants