thomashoneyman/purescript-halogen-hooks

Consider absorbing `use*State` convenience functions from Hooks.Extra

milesfrain opened this issue · 2 comments

It took me a while to notice:

  1. This section on useStateFn
  2. useStateFn is available in Hooks.Extra
  3. Hooks.Extra also has useModifyState

These convenience functions are handy enough to include in this repo, but I'd also be happy with them in Hooks.Extra if they're featured in the docs for easier discoverability. That would help make this API match the conciseness of react-hooks-basic (as discussed in #30).

Related PR: JordanMartinez/purescript-halogen-hooks-extra#7

As discussed in #30 I would like to keep this repository to a single useState, and defer the various ways that you can modify that call to produce other Hooks to the documentation and to other libraries like hooks-extra.

I've been reluctant to link out to external libraries because it means that the documentation can get out of date if the other libraries update, but I think it's harmless to at least link to hooks-extra and note that it includes implementations of useStateFn, useModifyState, etc.

I think it's harmless to at least link to hooks-extra and note that it includes implementations of useStateFn, useModifyState, etc.

That should be fine. I doubt those implementations will be going anywhere anytime soon.