--- title: RippleButton tags: visual,state,effect,intermediate --- Renders a button that animates a ripple effect when clicked. - Define some appropriate CSS styles and an animation for the ripple effect. - Use the `React.useState()` hook to create appropriate variables and setters for the pointer's coordinates and for the animation state of the button. - Use the `React.useEffect()` hook to change the state every time the `coords` state variable changes, starting the animation. - Use `setTimeout()` in the previous hook to clear the animation after it's done playing. - Use the `React.useEffect()` hook a second time to reset `coords` whenever the `isRippling` state variable is `false.` - Handle the `onClick` event by updating the `coords` state variable and calling the passed callback. - Finally, render a ` ); } ``` ```jsx ReactDOM.render( console.log(e)}>Click me, document.getElementById('root') ); ```