Home > Back-end >  Passing empty props changes the Button color in ButtonGroup
Passing empty props changes the Button color in ButtonGroup

Time:10-08

I'm using a customized IconButton element with ButtonGroup.

While passing an empty props, the color and hover shape of element is also changed. I want to know why did this happen? For me, an HOC shouldn't have different render effect with an empty prop passed.

I hosted a customized component without passing "{...props}"

Using a new customized component.

Misbehavior: buttons are white and not in group. See the hover highlight of second and third "G" The component is based on IconButton without passing {...props}.

customized component with {...props}.

Using a new customized component. All good.

The component is also based on IconButton but passing {...props}. Although the props is not passed, hence should be empty(?). Maybe useStyles changed color, but the hover background shape is changed too.

Also I made a Codesandbox Demo

  • Related