# Pure Jsx
<button onClick={()=> alert('hello') }>click</button>
# functional
() => { const Button = () => <button onClick={()=> alert('hello') }>click </button> return <div><Button /></div> }
# external library
function App() { // this is an external library (styled component) const Button = styled.button` background-color: #000; color: #fff; `; const [count, setCount] = React.useState(0); const onCount = () => setCount(count + 1); return <div>{count} <Button onClick={onCount}>Click me</Button></div> } render(<App />)
0
# syntax Highlighter with readOnly
() => { const [count, setCount] = React.useState(0); const onCount = () => setCount(count + 1); return ( <div> {count} <button onClick={onCount}>Click me</button> </div ); }