Skip to content

Instantly share code, notes, and snippets.

@cotyembry
Created March 8, 2017 01:56
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 cotyembry/8c75652dcc3f951e2657bd0a28fa348e to your computer and use it in GitHub Desktop.
Save cotyembry/8c75652dcc3f951e2657bd0a28fa348e to your computer and use it in GitHub Desktop.
This shows an awesome way to manage unique keys with references uniquely identified
	this.Sections = [];
	//by using block scope introduced by let, I am able to pass a unique value to each different child, in order to uniquely identify them without any other dependencies
	for(let i = 1; i <= 4; i++) {
		this.Sections.push(
			<div style={styles.section} key={'parent_' + i} className='section'>
				<div style={styles.header} key={i} onClick={() => this._onClick(i)} className='header'></div>
			</div>
		)
	}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment