1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【React練習問題】②カスタムhooksをつかって表示制御をしよう

Last updated at Posted at 2019-12-21

概要

これはReactを学ぶ上で、実際の現場で利用できる実装を取得するためのプログラム。
可読性、パフォーマンスなども求める。

課題仕様

コードサンドボックスを利用する
https://codesandbox.io/s/

画面

・commentを表示するためのボタンを2つ作る
・表示ボタンを押すと、コメントとその表示を消すボタンがコメントと同じ要素内に用事される
以下、私の実装結果の画面

comment実装.gif

ルール

・FCでつくる
・useStateを1回だけ使う
・useCallbackを2回だけ使う
・memoを使う

ヒント

・useStateを1回だけ使う
・useCallbackを2回だけ使う
これはカスタムフックスを使うことで解決できる

回答

1
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?