logtrace / material-icons-react

Google material icons implementation for React
MIT License
24 stars 16 forks source link

Allow updating of props #41

Open sibbl opened 5 years ago

sibbl commented 5 years ago

I currently have troubles with switching an icon depending on whether a menu is open.

Neither

<MaterialIcon icon={this.state.isOpen ? "close" : "add"}/>

nor

{ this.state.isOpen ? <MaterialIcon icon="close" /> : <MaterialIcon icon="add" /> }

work properly. The icon is never updated in the DOM.

The only workaround is to use the key attribute, but I'd expect this to work out of the box using componentDidUpdate.

PYDeret commented 5 years ago

Is this planned to be up soon ?