Created
January 25, 2018 13:29
-
-
Save aslan144/d351349deb44e7599ad8215be6a370a6 to your computer and use it in GitHub Desktop.
[S_Ract] #react
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------İMAGE------------ | |
// GOOD | |
<Image source={require('./my-icon.png')} />; | |
// BAD | |
var icon = this.props.active ? 'my-icon-active' : 'my-icon-inactive'; | |
<Image source={require('./' + icon + '.png')} />; | |
// GOOD | |
var icon = this.props.active | |
? require('./my-icon-active.png') | |
: require('./my-icon-inactive.png'); | |
<Image source={icon} />; | |
------------------------------------------------------ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment