Skip to content

Instantly share code, notes, and snippets.

@smcnally
Created April 2, 2020 03:06
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 smcnally/1647f8f055749627df9c9abf3eac790f to your computer and use it in GitHub Desktop.
Save smcnally/1647f8f055749627df9c9abf3eac790f to your computer and use it in GitHub Desktop.
looping through all properties, through lists of properties I filter, and generally less Insane ways to do what I did here
https://github.com/smcnally/GP-IQ/commit/53afcc3a3f6dfe118e83c9feadf586c6de88991a#r38218311
let scoreLabel = props.scoreLabel;
let successImg = props.successImg;
let bio = props.bio;
// ad naseum
if (scoreLabel) {
scoreLabel = <p className="result-answer" dangerouslySetInnerHTML={{__html: props.scoreLabel}} />;
} else {
scoreLabel = '';
}
if (successImg) {
successImg = <img className="constrain-300x600" src={props.successImg} alt="Success" />;
} else {
successImg = '';
}
if (bio) {
bio = <p className="result-bio" dangerouslySetInnerHTML={{__html: props.bio}} />;
}
// ad naseum
// and buggering the whole thing by moving to something better than properties this way in 16.x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment