robbestad/react-iframe

What's the difference with just using `<iframe ... />`?

Closed this issue · 9 comments

I'm trying to understand why anyone would use this library, where they can simply use a plain <iframe />.

What does this library do, apart from wrapping the iframe in a PureComponent, and limiting support to only the defined properties?

As with most things.

Of course, but this is becoming absurdly trivial with React 16.6.0, by using React.memo;

export const Iframe = React.memo((props) => React.createElement('iframe', props));

Also, if this is for convenience, why not forward all the props to the <iframe />?

@svenanders You didn't really answer this issue, why did you close it?

This repo has alot of code in place to provide a package for this purpose. How relevant is it these days for users of React 16.6+ that could use the memo approach mentioned above?

Why aren't props forwarded via spread? You have to provide updates when a user mentions a need for attribute support that could otherwise be handled. Perhaps there's a reason for that(or at least was in the past) due to issues users faced when using this package in ways different from most?

For convenience. You you can wrap it up yourself and do the things this lib
does yourself, sure. As with most things.

The README for the repo doesn't explain what those "things" are. Some clarification would be great. I completely understand if there are special use cases or legacy reasons where this package would be a better choice.

I regarded the original question as rather hostile.

The only reason why you would think so is because apparently it is true; this library doesn't provide any value over using a normal iframe.

But my question initially was out of interest, I was wondering if I maybe missed a special case.

Marketing this lib in that it has typescript types is not much added value either, given the fact that the html iframe tag already has types.

I think in general this library is misleading for newcomers to the ecosystem, and it could do better in actually explaining what this library does, and how people could go without.

And your comment actually emphasizes the fact;

Forwarding the props would be pointless. The repo would be ‘const Iframe = props => <iframe {...props} />’ in that case.

I’m sorry you don’t understand the point of this repo.i advise you to avoid it and use something else. I further advise you to spend your time searching out other libs you don’t like or agree with and ask them to provide alternatives.