1
1
12332112020-06-01 11:57:27
JavaScript
1233211, 2020-06-01 11:57:27

Is it possible to create and return 3 variables in custom hooks?

Is it possible to do something like this? Is this normal practice?

const [value, value1, setValue] = useMyCustomHook();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-06-01
@1233211

Do what is more convenient for you. As the documentation says ,

a custom hook does not need to have a specific signature. We can decide what it takes as arguments and whether it should return anything. In other words, everything is as in ordinary functions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question