Adam Ahmed
Sep 1, 2018 · 1 min read

Sorry for the late reply, I don’t get notifications. I agree. You don’t have to use Redux, that was just an example of an alternative (probably not the best one, but I was going for familiarity — mea culpa). React Context is another.

Ultimately, I’m just saying that if you’re sharing non-UI logic, that it’s probably best to share it without a dependency on your UI library (to avoid bloated bundles, to avoid a version compatibility matrix with React, etc).

There might be some value in internally sharing the Probability React wrapper to remove boilerplate, but ideally that file would really just contain boilerplate for hooking into the UI-agnostic logic (as written above).

The OP mentions downshift, which actually does contain UI logic — it orchestrates interactions between an input, label, and autocomplete menu. I can see more value in that kind of “headless” UI component being written in React since it deals with UI (it’s like “half-headed” more than “headless” with its getXProps() methods) and much of the value is the reactive style and React integration.

Hope this isn’t too controversial. Take care!

    Adam Ahmed

    Written by

    Father of two lovely boys. ex-Atlassian. Founder of https://www.mrnobody.com