Last active
September 5, 2019 07:31
-
-
Save mathieu-anderson/d12cb89ff4d947f339e6c34e024e7602 to your computer and use it in GitHub Desktop.
Inline types
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
import * as React from "react"; | |
import { render } from "react-dom"; | |
// Inline types | |
function InlineTsInput(props: { value: number | string; label: string }) { | |
const { value, label } = props; | |
return ( | |
<div className="container"> | |
<div className="label">{label}</div> | |
<div className="typeof"> | |
Type: <b>{typeof value}</b> | |
</div> | |
<input value={value} /> | |
</div> | |
); | |
} | |
function App() { | |
return ( | |
<div className="App"> | |
<InlineTsInput value={1} label="TS inline types" /> | |
</div> | |
); | |
} | |
const rootElement = document.getElementById("root"); | |
render(<App />, rootElement); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment