Skip to content

Instantly share code, notes, and snippets.

@mishalrai
Created April 24, 2018 07:07
Show Gist options
  • Save mishalrai/eea650ca137e1b8bfa4094441921ecd8 to your computer and use it in GitHub Desktop.
Save mishalrai/eea650ca137e1b8bfa4094441921ecd8 to your computer and use it in GitHub Desktop.
getNameNRenderElement() {
( () => {
let nameList = {},
returnObj = {};
return (args => {
if (Object.keys(nameList).length > 0) {
console.log(returnObj, 'return form momize');
return returnObj;
}
let renderElement = this.props.tags.map(({ name, text, imgUrl }) => {
nameList[name] = false;
let id = getRandomId();
return (
<li key={id} >
<input type="checkbox" name={name} id={id} hidden />
<label htmlFor={id}>
<Icon imgUrl={imgUrl} />
<Tag text={text} />
</label>
</li>
)
})
console.log(Object.keys(nameList).length, 'length' );
returnObj = { nameList, renderElement };
return returnObj;
});
})()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment