I just finished the front-end calculator project and was pretty happy so I decided to go back and try to fix up my quote machine project. It passed the tests but the tweet icon would not render on Netlify.
I spent all of yesterday trying different things to no avail.
Here’s the issue:
<a
id="tweet-quote"
href={"https://twitter.com/intent/tweet?text=" + state.quote[0]}
>
tweet
</a>
Will render on localhost:3000. You can click it and it will work as intended. If I deploy on Netlify it won’t render. The element is there but it is invisible - hence you can pass the tests. If I npm run build
and host locally with serve -s build
the element also does not render.
Incidentally I can get it to work in a build version using a button with:
const handleClick = () => {
window.location.href =
"https://twitter.com/intent/tweet?text=" +
state.quote +
" - " +
state.author;
};
You can recreate this by running create react app. Add a href with "https://twitter.com/intent/tweet"
and it will render in build and locally.
Change the href to "https://twitter.com/intent/tweet?text="
and it will render locally but not in the build version.
Any ideas?