maximilienGilet / react-hooked

https://react-hooked.vercel.app
82 stars 10 forks source link

Hook files with tsx extension will not be displayed in the list #9

Closed Hamzah-Ahmad closed 1 month ago

Hamzah-Ahmad commented 1 month ago

The getHooks hook is looking for files with the .ts extension. I am working on a useConfirm hook to allows to easily prompt for confirmation from the user. The hook returns a modal component, and thus I need to mark the file with the tsx extension.

( If returning JSX from a custom hook is considered bad practice, please let know)

maximilienGilet commented 1 month ago

Hi @Hamzah-Ahmad !

Thanks for the contribution, however returning JSX in hooks is generally not a good idea since hooks should be UI agnostic.

Some libraries like Material UI does this because they provide tightly coupled components, but it's a completely different approach from this project.

A UI agnostic version of this hook is welcomed, let me know if you have questions.

Hamzah-Ahmad commented 1 month ago

Thank you for the getting back to me. I understand. The modal was completely custom built using simple React and CSS (0 dependencies). I'm not sure if that counts as UI agnostic. Thanks either ways.