Last active
November 29, 2021 09:49
-
-
Save omas-public/9400a010938855c428c31c069a544737 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
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