DEV Community

Discussion on: Do I have to use Arrow Function in Function Components in React

Collapse
 
ekeijl profile image
Edwin • Edited

There is no preference when using hooks, but they are not the same.

Both function declarations function Name() {} and function expressions const 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.