DEV Community

Discussion on: Write Custom Hooks in React

Collapse
 
mwoodson profile image
marques woodson

I don't know if I'd say one way is better than the other. I return arrays sometimes if there aren't a lot of objects being returned, but once I get more than 3 I would probably switch to returning an object. I also use a lot of Typescript, so defining the return type helps with not mixing up variables.