get-input-selection
getInputSelection() provides carrot position for textarea. Works as selectionBegin and selectionEnd for all browsers
usage
import getInputSelection from 'get-input-selection';
const { begin, end } = getInputSelection(textarea);