reactjs - Render component when receive props ans styled it inline -
i try render component when parent receives props. catch error:
element type invalid: expected string (for built-in components) or class/function (for composite components) got: object. use material ui, when icon props true need render element inside floatingactionbutton. in case use <icon />
catch error, in case use icon - wroks, how apply styles.
const iconbutton = ({color = 'normal', icon, ...props}) =>{ let icon = icon console.log(icon) return <floatingactionbutton disabletouchripple mini zdepth={1} {...props} {...getstyle(color, props.disabled, props.icon)} > {!!icon && <icon />} </floatingactionbutton> } <iconbutton color='hightligted' icon={<add />} />
this variant works, how set style in case icon :
{!!icon && icon}
Comments
Post a Comment