It's a good or bad pattern spread an object as props like this and why ? and in case it's a bad patter what's the best choice in this case ?
Thanks :D
render() {
let theProps = {
wrapper: {
image: this.props.image,
pattern: pattern,
open: this.state.open
},
ctaButton: {
showCondition: (typeof this.props.ctaText === "string") && (this.props.ctaText.length > 0),
className: "bz-big bz-white bz-z-element",
children: <FormattedMessage id={this.props.ctaText} />,
action: this.props.ctaAction
}
};
return (
<Wrap {...theProps.wrapper}>
<ActionButton {...theProps.ctaButton} />
</Wrap>
);
}
Aucun commentaire:
Enregistrer un commentaire