reactjsfacebookfacebook-share

react facebook share button does not work


share` libraryto use Facebook share button with react and this is the code

render(){
var url = `http://localhost:3000/${this.props.match.params.id}/${this.props.match.params.name}`
  return (
    {/*some other codes*/} 
    <FacebookShareButton url={url} quote={"გააზიარე"} className="share">
         <FacebookIcon size={32} round={true}/>
    </FacebookShareButton>
   )
}

but it does not work, I mean it opens facebook window but showing some error about domain name, i think this problem is common, because i did everything according to documentation. what is problem?


Solution

  • You cannot share a localhost link, that link is only available on your own computer. Shared URLs need to be accessible by Facebook in public.

    UPDATE:

    Facebook shows an error message now saying "localhost won't work".