Skip to content

Instantly share code, notes, and snippets.

@nknighta
Created September 26, 2023 07:36
Show Gist options
  • Save nknighta/d637d6b798a3a7c2d60cd99e7efb1882 to your computer and use it in GitHub Desktop.
Save nknighta/d637d6b798a3a7c2d60cd99e7efb1882 to your computer and use it in GitHub Desktop.
Count-and-Move
import React, {useState} from "react";
export default function Index () {
const [count, setCount] = useState(0);
return (
<>
test ui app
{count}
<div>
<button onClick={() => {
setCount(count + 10)
}}>up</button>
<button onClick={() => {
setCount(count - 10)
}}>up</button>
</div>
<div style={{
paddingTop: count,
}}>
move!
</div>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment