xxxxxxxxxx
import React from 'react'
function RunawayButton({ children }) {
let left = 0
let top = 0
let position = left ? 'absolute' : 'fixed'
return (
<button
onMouseMove={event => {
console.log({
left: event.clientX + 2,
top: event.clientY + 2,
})
}}
style={{
left,
top,
position
}}
>
{children}
</button>
)
}
function App() {
return (
<div>
<RunawayButton>One does not simply... click the button.</RunawayButton>
</div>
)
}
export default App