Skip to content

Instantly share code, notes, and snippets.

@omas-public
Last active November 29, 2021 09:49
Show Gist options
  • Save omas-public/9400a010938855c428c31c069a544737 to your computer and use it in GitHub Desktop.
Save omas-public/9400a010938855c428c31c069a544737 to your computer and use it in GitHub Desktop.
import { useState } from 'react'
const FormView = ({ count }) => (
<p>{count}</p>
)
const ActionView = ({ handleClick }) => (
<button
onClick={handleClick}
>
count up
</button>
)
const App = props => {
const [count, setCount] = useState(0)
const succ = v => v + 1
const increment = event => setCount(succ)
return (
<>
<FormView count={count} />
<ActionView handleClick={increment} />
</>
)
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment