DEV Community

Discussion on: useState or const: what's the difference?

Collapse
 
dance2die profile image
Sung M. Kim

// 1. needsTacos "can" trigger re-render.
// 2. needsTacos doesn't trigger re-render (same goes for ref by useRef)

Collapse
 
omgitsgod profile image
Ryan Penchenski

Wouldn't you need a "setNeedsTacos" to trigger a re-render?

Collapse
 
dance2die profile image
Sung M. Kim

Yes, you are right, Ryan.

Updating the state using setNeedsTacos "can" cause the re-render.

Collapse
 
revalenza profile image
Robert Valenzuela

thx this help me to understand the difference