-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Foreign importing hooks #57
Comments
I don't have much experience using FFI for hooks, but I put together a small example to give one idea of how you could go about it here: https://github.com/ptrfrncsmrph/demo-foreign-import-hooks/blob/main/src/Foreign/Hooks.purs Usage would look like: https://github.com/ptrfrncsmrph/demo-foreign-import-hooks/blob/eb7523b16957df1465d79c81bb87b3178a8ff0da/src/App.purs#L14-L35 In PureScript I don't think we have a giant sum type representing all the possible event types in this In my example I've got the |
I'm not sure if it's good practice to leave the internal newtype UseEventListener hooks = UseEventListener hooks instead of typing them out like in https://github.com/megamaddu/purescript-react-basic-hooks/blob/4904b69821579f2c1fc3cac9f730892380216661/src/React/Basic/Hooks/Aff.purs#L58-L63 I'd imagine you'd want to leave them as just opaque |
Wow, thanks! Maybe this should make it into the docs or at least the cook books? |
How would one approach this?
For example, use-on-click-outside or use-event-listener?
The text was updated successfully, but these errors were encountered: