DEV Community

Discussion on: How to write custom hooks in React

Collapse
 
shenmander profile image
shenmander

"By convention, the name of a hook function should start with ‘use’. It doesn’t have to, but if it doesn’t people won’t easily realise it’s a hook."

Are you sure about this? I tried changing one of my functions name from useBlah to getBlah and it broke.

Collapse
 
nemethricsi profile image
Richard

now reactjs.or says: "Its name should always start with use so that you can tell at a glance that the rules of Hooks apply to it."