adding ref to js alternatives