---
title: "Discussion on \"React refs in a loop\" | Hashnode"
description: "Discussion on \"React refs in a loop\". What is a ref?\nThere's a clue in the name: it references an element.\nIf you have a button in HTML with a class of myElement, then you can refer to it in JavaScript like this:\nconst myElement = document.querySelector('.myElement');\nmyElement.addEventL..."
url: "https://hashnode.com/posts/react-refs-in-a-loop/604c9cdc49698807cc47f117"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [React refs in a loop](https://blog.nicm42.me.uk/react-refs-in-a-loop?utm_source=hashnode&utm_medium=feed)

What is a ref? There's a clue in the name: it references an element. If you have a button in HTML with a class of myElement, then you can refer to it in JavaScript like this: const myElement = document.querySelector('.myElement'); myElement.addEventL...

Mar 13, 2021 · 5 min read · blog.nicm42.me.uk  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#reacthooks](https://hashnode.com/tag/reacthooks)

## Written by

[Nic](https://hashnode.com/@nicm42)

@nicm42 · England

  
[View profile](https://hashnode.com/@nicm42)

This week I learnt...

Front End Developer. I like problem solving and making things pretty. I also like red.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
