Should hooks always return an array?

theianjones

Ian Jones

Posted on March 1, 2019

Should hooks always return an array?

Looking at gatsby's useStaticQuery, it just returns an object where I would expect it to return an array. I've been using urqls useQuery lately and it returns and array with the result in the first spot of the array.

Is this just a preference or should this be a convention our libraries should follow?

💖 💪 🙅 🚩
theianjones
Ian Jones

Posted on March 1, 2019

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related