Is it preferable to use Arrow Function in React, while always using Function Components with React Hooks, instead of using Class Components.
Do I have to use Declarable Function Name() { }
or Arrow Function () => { }
.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (1)
There is no preference when using hooks, but they are not the same.
Both function declarations
function Name() {}
and function expressionsconst Name = () => {};
are perfectly fine when using React hooks. The main difference is that function declarations are hoisted (moved) to the top of their scope, see here for an explanation.