I’ve been working over the last week to revamp the link previews package to be less hacky. It’s now much simpler to do fancy things like combine it with a dynamic framework like svelte, react, or vue. Using it with svelte is crazy simple; this component is just 16 lines long. The react version is 30 lines.
Under the hood, I’m using a MutationObserver
to watch the element for changes and updating the custom component accordingly. This way, the framework wrapper shouldn’t need to deal with lifecycle stuff and manually removing/updating it when the props change. Makes things super clean.