I'm trying to use the following react library to create a rich url preview component for my application.
https://docs.microlink.io/sdk/getting-started/react/
In the above documentation there's a working demo, so there's no question about the library. But when i try to use this library i'm getting the following error.
Uncaught (in promise) Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in.
My code
import MicrolinkCard from 'react-microlink'
class Star extends Component {
render() {
<MicrolinkCard url='https://www.theverge.com/tldr/2018/2/7/16984284/tesla-space-falcon-heavy-launch-elon-musk'/>
}
}
I tried changing import MicrolinkCard from 'react-microlink'
to import {MicrolinkCard} from 'react-microlink'
but still get the same error.
you need to return it in your render: