# What does it mean to be done declaratively?

**URL:** <https://forum.kirupa.com/t/what-does-it-mean-to-be-done-declaratively/644418>\
**Category:** programming\
**Created:** [October 2, 2020, 10:57am UTC](https://forum.kirupa.com/t/what-does-it-mean-to-be-done-declaratively/644418 "2020-10-02T10:57:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shahab570](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/shahab570/32/12965_2.png) [@shahab570](https://forum.kirupa.com/u/shahab570)\
**Post date:** [October 2, 2020, 10:57am UTC](https://forum.kirupa.com/t/what-does-it-mean-to-be-done-declaratively/644418/1 "2020-10-02T10:57:42Z")

</div>

I was reading the React “refs and the DOM” section. I don’t understand this line.  
“Avoid using refs for anything that can be done declaratively”. can anyone explain what does this line mean?

---

<div class="post-metadata">

**Author:** ![kirupa](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kirupa/32/11616_2.png) [@kirupa](https://forum.kirupa.com/u/kirupa)\
**Post date:** [October 2, 2020, 3:31pm UTC](https://forum.kirupa.com/t/what-does-it-mean-to-be-done-declaratively/644418/2 "2020-10-02T15:31:55Z")

</div>

Refs are sort of an anti-pattern in how UIs are supposed to be built in React.

- Accessing the DOM element directly is not heavily smiled upon ☹
- It is preferred to work with state and props and indirectly get your UI get updated 🙂

Welcome to the forums @shahab570!

Cheers,  
Kirupa
