skip to Main Content

Reactjs – Create ref for elements in loop

I have an array of react elements that I output using the map function: { elemsList.map((item, i) => { return ( <div key={i} ref={refsArr[i]} data-grid={item.props["data-grid"]} onClick={e => doubleClickHandler(item.key, e)} style={{ backgroundColor: i === selectedComponent ? '#828EE3' : "#102f6a", color: "#fff",…

VIEW QUESTION

Reactjs – In which types exit property e.changedTouches? (React + TypeScript)

I want fix all errors I have this error 1 And this error 2 My code function onMouseTouchDown(e: React.SyntheticEvent<HTMLDivElement>) { e.preventDefault() setDown(true) if (e.type === "touchmove" && e.changedTouches) { setX(e.changedTouches[0].pageX - e.currentTarget.offsetLeft) } else { setX(e.pageX - e.currentTarget.offsetLeft) } setScrollLeft(e.currentTarget.scrollLeft)…

VIEW QUESTION
Back To Top
Search