Skip to content

Instantly share code, notes, and snippets.

@aslan144
Created January 25, 2018 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aslan144/d351349deb44e7599ad8215be6a370a6 to your computer and use it in GitHub Desktop.
Save aslan144/d351349deb44e7599ad8215be6a370a6 to your computer and use it in GitHub Desktop.
[S_Ract] #react
----------------İ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