Skip to content

Instantly share code, notes, and snippets.

@meramos
Created December 20, 2020 03:32
Show Gist options
  • Select an option

  • Save meramos/5e8947254abfff8f7f93590c945aba3a to your computer and use it in GitHub Desktop.

Select an option

Save meramos/5e8947254abfff8f7f93590c945aba3a to your computer and use it in GitHub Desktop.
(shorter code) Update divs which were added earlier so that their class values are defined based on the current image per item.
// dressupState was defined earlier
<div id="container">
<div id="background">
<div id="body"></div>
{ Object.keys(dressupState).map((item) =>
<div id={item} className={item+(dressupState[item].current+1)} key={item}></div>
)
}
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment