DEV Community

Discussion on: Writing my first custom react hook - useOutsideClick

Collapse
larsejaas profile image
Lars Ejaas

I think someone new to React might be intimidated by the name: custom hook. It sounds complicated right!!? But it really just is a way to keep some of the state logic in a seperate file outside the component. This gives you 2 benefits: 1: the code/logic is easy to reuse in the project and 2: It helps clean up your components code. Trust me: This one is huge! Especially in large(r) projects.