Precisely. I've made a few adjustments to make it work on codepen, but the gist is there:
Rather than selecting the variant settings from within the Card, we supply the variant settings to the card. The result is ultimately still that you just call, e.g. <ReactCard /> with your show, headerText, and text props, but now you can easily extend this to support, for instance, an AngularCard without having to touch Card at all:
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Precisely. I've made a few adjustments to make it work on codepen, but the gist is there:
Rather than selecting the variant settings from within the Card, we supply the variant settings to the card. The result is ultimately still that you just call, e.g.
<ReactCard />
with yourshow
,headerText
, andtext
props, but now you can easily extend this to support, for instance, anAngularCard
without having to touchCard
at all: