react-youtube icon indicating copy to clipboard operation
react-youtube copied to clipboard

Use hooks, support React 18, drop React <16

Open goto-bus-stop opened this issue 3 years ago • 1 comments

npm install @u-wave/react-youtube@next

This will be version 1.0 of the library. It uses hooks internally instead of a class. It exposes a useYouTube hook so you can attach a player to an element that way. <YouTube /> is a very boring wrapper around that hook. The hook also provides easier access to the player instance.

Breaking changes

  • The package now requires React 16 or later.
  • The package targets modern browsers, it uses ES2015 syntax. Transpile it if you need broader support.
  • showInfo and suggestedQuality props are removed: these were already removed from the YouTube API a few years ago and have had no effect ever since.

Otherwise the API remained exactly the same.

Todo

  • [ ] Need to make sure the unmount order with the hook API is right, as the YT SDK has some strict expectations about that.

goto-bus-stop avatar Jun 30 '21 11:06 goto-bus-stop

Node.removeChild: The node to be removed is not a child of this node

The iframe should be destroyed before react tries to unmount it, maybe useLayoutEffect would work.

goto-bus-stop avatar May 02 '22 12:05 goto-bus-stop