re: Should hooks always return an array? VIEW POST

FULL DISCUSSION
 

I don't know about Gatsby (just learning), but hooks could return anything, not just arrays. Looking at the build in React hooks, the arrays format is used in useState and useReducer, but useContext for example return an object and useEffect return nothing. In your custom hooks, you could return anything, so theoretically, any hook in Gatsby could return what they want, not only arrays.

code of conduct - report abuse