Skip to content
Discussion options

You must be logged in to vote

Depends on where you’re runnign things. This works fine in Node.
react instead of a URL is a Node (or import map) thing. Outside of Node (or an import map) it doesn’t resolve.

You can use actual, full, imports. E.g., import react from esm.sh or so.
You could investigate import maps, to map react to a certain URL.

Otherwise, you’d have to do bundling. But that comes with a problem: now there’s a react in your bundle. And another React on the outside. And those two Reacts, due to how React works, don’t play together nicely.

The easiest way is to rethink your problem: define MyDynamicButton from outside and pass it in.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by petertjmills
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants