Last active
December 10, 2024 12:31
-
-
Save mistakster/d84d8f7e931fe5e19c53ea2b82b89f41 to your computer and use it in GitHub Desktop.
A case for interviewing a React developer
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 Page = () => { | |
const [value, setValue] = useState(0); | |
return ( | |
<Counter | |
value={value} | |
increase={() => setValue(value + 1)} | |
/> | |
); | |
}; | |
const Counter = (props) => { | |
const { value, increase } = props; | |
return ( | |
<div> | |
<span>{value}</span> | |
{' '} | |
<button onClick={increase}>+1</button> | |
</div> | |
); | |
}; | |
export default Page; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment