1
0

Reactアプリ100本ノックやってみた 「02 Counter」

Posted at

はじめに

フロントエンドに苦手意識のある私が、@Sicut_studyさんの【Reactアプリ100本ノック】をやってみました。
変なところがあれば教えていただきたいです。

今回の課題

やってみる

App.tsx
import { Box, Button } from "@mui/material";
import { useState } from "react";



const App = () => {
  const [count, setcount] = useState(0);

  return (
    <div>
      <Box>{count}</Box>
      <Button variant="contained" onClick={()=>setcount(count + 1)}>+</Button>
      <Button variant="contained" onClick={()=>setcount(count - 1)}>-</Button>
    </div>
  );
};

export default App;

完成

Animation.gif

おわりに

useState()を使用したことが過去にあったので苦戦しませんでした。次のお題は難しそうですが頑張ります。。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0