Created
December 5, 2016 19:39
-
-
Save imkost/a59732d2995a7764623f22460cec0e7b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function App({ url }) { | |
return ` | |
... | |
${NameEditor({ id: 0 })} | |
${NameEditor({ id: 1 })} | |
${NameEditor({ id: 2 })} | |
... | |
` | |
} | |
function NameEditor({ id }) { | |
return ` | |
<div class="nameEditor"> | |
<div>Enter you name:</div> | |
<input onKeyUp="NameEditor.onKeyUp(this, ${id})" /> | |
<div> | |
Hello, <span id="nameEditor__name-${id}"></span> | |
</div> | |
</div> | |
`; | |
} | |
NameEditor.onKeyUp = (input, id) => { | |
document.getElementById(`nameEditor__name-${id}`).innerText = input.value; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment