Skip to content

Instantly share code, notes, and snippets.

@valex
Created October 23, 2018 16:36
Show Gist options
  • Save valex/f2bacea8c9603b6b0aed12dd3091379f to your computer and use it in GitHub Desktop.
Save valex/f2bacea8c9603b6b0aed12dd3091379f to your computer and use it in GitHub Desktop.
defaultValue
<!DOCTYPE html>
<html>
<head>
<title>defaultValue</title>
<meta charset="utf-8">
</head>
<body>
<div id="app">
<!-- my app renders here -->
</div>
<script charset="utf-8" crossorigin src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
<script type="text/babel">
function log(event) {
console.log("value: ", event.target.value);
console.log("defaultValue: ", event.target.defaultValue);
}
ReactDOM.render(
<input defaultValue="hello" onChange={log} />,
document.getElementById('app')
);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment