Open ethul opened 5 years ago
@natefaubion Thanks for taking a look at all of this!
Example usage of hooks: https://github.com/ethul/purescript-react-example/tree/hooks
It's definitely worth looking at the react-basic
implementation which uses indexed-monads and qualified do
to make it ergonomic and type safe.
Thanks for pointing out the react-basic
hooks implementation. It is a nice representation. A part of me wonders if it would make sense to have a more general hooks implementation that can be shared among purescript react libraries.
On another note, and as a point for discussion, I suppose I am a bit on the fence about tracking hooks via the index-monad, which seems along the lines of how Eff
tracked effects (unless I am not understanding this correctly). I can see the how this could be handy, but I may need to mull over the pros and cons a bit more. But I am open to ideas on this.
Should this PR be closed? AFAIK, most people use react-basic
now, which also has a hooks library.
Proposal for supporting React Hooks.
This code is still in the early stages and requires some ideas to be worked out further, but perhaps it is a useful start for a discussion. Any comments, questions, or suggestions are most welcome.
// @natefaubion