What is the technical definition of a react hook?

Viewed 36

I am a beginner in react and of all the information i have gathered so far is that you can create a custom hook in react. But what qualifies as a hook? If I create a normal Javascript function and begin its name with use Is that now a hook?

Example

  const useMultiple = (number, multipliedBy) => {
    return [number, number * multipliedBy];
  };

  const [number, multipliedBy] = useMultiple(2, 3);

Can i call useMultiple my custom hook? Are there any rules or requirements for something to be a hook?

0 Answers
Related