justinmahar / react-social-media-embed

📰 Easily embed social media posts from Facebook, Instagram, LinkedIn, Pinterest, TikTok, X (Twitter), and YouTube in React.
https://justinmahar.github.io/react-social-media-embed/
MIT License
215 stars 30 forks source link

Import via CDN #34

Open martmilitante opened 1 year ago

martmilitante commented 1 year ago

I'm trying to import this package via import reactSocialMediaEmbed from 'https://cdn.skypack.dev/react-social-media-embed'; using babel standalone and react.

The problem is when I put it as a JSX Element in react, I'm getting an error image


<script type="text/babel" data-type="module">
import reactSocialMediaEmbed from 'https://cdn.skypack.dev/react-social-media-embed';

 const InstagramEmbed = () => {
   const Embed = reactSocialMediaEmbed .InstagramEmbed;

   return (
     <Embed url="url" />
   );
 }

 // In App

 function App() {
   <InstagramEmbed />
}
</script>

it give me Invalid hook call. Hooks can only be called inside of the body of a function component.