Untitled
unknown
plain_text
a year ago
676 B
8
Indexable
const BaseButton = () => {} // button bez CS const Button = withClickstream(BaseButton) // button z CS const useClickstreamEnabled = () => { const isEnabled = useContext(SomeContext) // jakiś kontekst będziemy mieć skąd będziemy wiedzieć czy używamy CSa w danym projekcie czy nie } const withClickstreamOrWithout = (ComponentWithoutCS, ComponentWithCs, clickstreamId) => { const csEnabled = useClickstreamEnabled() return csEnabled ? <ComponentWithCs clickstreamId={clickstreamId} /> : <ComponentWithoutCS/> } const Alert = () => { <Box> {withClickstreamOrWithout(BaseButton, Button, "myButtonCSid")} </Box> }
Editor is loading...
Leave a Comment