You can make sure the tooltip flips position to avoid going off the edge of the screen using just CSS?
Having 10kb tooltip library for doing this automatically is a bit of an overkill for me [1].
Of course, but I hardly see how that's comparable to writing a React class "ToolTip" which is smart enough to know where the side of the screen is, and comes with the ability to use JS.
I'm sure it can be done if you create enough media selectors for every common resolution but outside of that...