prism icon indicating copy to clipboard operation
prism copied to clipboard

Provide a wrapper compatible with the library-provided unwrapper

Open amakhrov opened this issue 7 years ago • 0 comments

The library provides the standard unwrapper (https://github.com/salsita/prism/blob/master/packages/prism-redux/src/unwrappers/buildUnwrapper.ts). This unwrapper assumes a particular format of a wrapped action.

However, there is no standard wrapper compatible with this unwrapper. One has to write it themselves every time. And if the standard unwrapper changes in future versions, the existing code will break.

A possible approach would be to expose a standard action wrapper:

// buildWrapper.js - a part of the prism library
export default (prefix: string) => (action: string) => `${prefix}.${action}`;


// usage in a component
<InstantiableConnectedCounter
    selector={state => state.topCounter}
    wrapper=buildWrapper('TopCounter')
/>

amakhrov avatar Jun 01 '17 17:06 amakhrov