What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-03-05 15:30:03
Javascript - Track mouse position
<p>Click in the div element below to get the x (horizontal) and y (vertical) coordinates of the mouse pointer, when it is clicked.</p> <div onclick="showCoords(event)"><p id="demo"></p></div> <p... Add solution -
Javascript 2022-01-28 21:55:07
antd dropdown stop propogation
/* Providing the */onClick={e => e.stopPropagation()}/* callback to the immediate child of */<Dropdown trigger={["click"]}>/* should solve the issue. This worked for me: */ return ( <Dropdown trigger={["click"]} overlay=... Add solution -
Other 2021-11-16 02:10:08
app-root modal component
// These two containers are siblings in the DOM const appRoot = document.getElementById('app-root'); const modalRoot = document.getElementById('modal-root'); class Modal extends React.Component { constructor(props) { super(props); this.el = doc... Add solution -
Javascript 2021-11-12 11:18:15
react pass props to children
import React, { Children, isValidElement, cloneElement } from 'react'; const Child = ({ doSomething, value }) => ( <div onClick={() => doSomething(value)}>Click Me</div> ); function Parent({ children }) { function doSomething(value... Add solution -
Javascript 2021-09-05 15:18:02
react get input value on button click functional component
const input = props => { let textInput = React.createRef(); function handleClick() { console.log(textInput.current.value); } return ( <div> <input ref={textInput} placeholder="Type a message..." /> <div onC... Add solution
Best helpers
Ranking is empty