React Question regarding deconstruction

const [content , setContent] = React.useState("Hey, comp here")

this^^^prompted a generalized question… what is the semantical relationship here?

in the following, i understand that cat is being ascribed the value “cat”
const cat = "cat"

and i think i get that (please tell me if im wrong) a variation of

const [cat , dog] = "pet"

gives both cat and dog the value of “pet”

but in the example used to question… im a little hazy on the semantics

  • you can consider “first as variable” and “second as updater function”

best would be if you refer to their docs, and may be consider looking into this article from there as well,m happy reading :slight_smile: State: A Component's Memory – React

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.