purescript-react/purescript-react-basic-hooks

Will React.Basic.Hooks replace React.Basic at some point?

ford-prefect opened this issue · 4 comments

We've got a bunch of code based on React.Basic and are planning on migrating to React.Basic.Hooks as the interface seems more logical / ergonomic. I was wondering whether this is a long term plan on consolidating these?

They're completely compatible, so there's not much of a rush, but yes, kind of.

The hooks api is capable of everything the non-hooks api is capable of, with some refactoring. Plus, useReducer and useAffReducer (under consideration here) make conversion pretty easy.

So we could eventually replace the React.Basic module with the React.Basic.Hooks module. I don't think this is the right approach, though, mostly because it would force the conversion of old components to get new hooks or react-basic libraries, and if a component is working just fine I don't think it makes sense to do that. Instead, I'd like to possibly split up the modules into smaller libraries:

  • react-basic-?: The existing React.Basic module
  • react-basic-v2-compat: The existing React.Basic.Compat module
  • react-basic-dom: All the modules under React.Basic.DOM in the current react-basic module
  • react-basic-hooks: Unchanged
  • react-basic-native: Unchanged
  • react-basic: A new release with only the React.Basic type definitions, and minus the React.Basic and React.Basic.Compat implementations.

This makes it easier for people to pick and choose the apis they like and maintain them separately without much conflict (as long as the ReactComponent and JSX types haven't changed anyway)

Thank you for the summary, this sounds good!
If there is anything I can help with when you decide to start this consolidation, please let me know.

So would the first item in your list (react-basic-?) be a minimal core that the rest of the react-basic libraries depend on?

edit: oh right no I see, react-basic would be the minimal core that other stuff depends on

done!