2

I stumbled onto code like this

const [activeChoice] = useState("flights");

Question Why would anyone just use the value returned from useState. The person who wrote the code is obviously never planning to update the value since he/she didn't destructure the setter function. Wouldn't it be easier to do just use a variable instead of adding the extra code "noise"? for example

const activeChoice = "flights";
Amos Machora
  • 143
  • 6

0 Answers0