-
Notifications
You must be signed in to change notification settings - Fork 1
Description
At present, the withTogglePointFactory and withToggledHookFactory have logic for selecting matching features and a matched variant.
The factories are supplied a join point and a map of potential features, with the resultant toggle point passed a method to retrieve active features (which is enacted following the rules of hooks...) then selecting an appropriate feature at runtime. If passed a reactive hook as this method, the result will re-render when the state changes.
Although this works, it does couple these factories to an exact featuresMap structure, with a top level "feature" and sub-ordinate "variants", but this may not suit all toggle schemes, and some of the example code has had to contrive a top level "feature" to be compatible.
So that these can become more generic (and to allow similar "toggle point factories" to be constructed, e.g. an object proxy or simple higher order function, perhaps just exports of the webpack package itself) these factories could receive a method to select a variant (and enact side-effects for also-rans, for use in plugins?) rather than a method to retrieve active features, thus divorcing them from a rigid featuresMap structure.
related: #37