3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

はじめに

こんにちは、エンジニアのkeitaMaxです。

今回はNext.jsにReactUseをインストールして使えるようにします。

ReactUseとは

Reactuse is a comprehensive collection of custom React Hooks designed to supercharge your functional components! you can easily unlock the full potential of React Hooks and leverage their power to create reusable and efficient code.
(引用:https://www.reactuse.com/)

便利な React Hookのライブラリです。

インストール

以下のでコマンドでインストールします。

npm i react-use

使用方法

使用したい箇所でuseEffectOneceなどと書いて、クイックフィックスをすると勝手にimportしてくれます。

useEffectなどと同じように使用することができます。

色々あるので、公式サイトをみてみてください。

自動でimportされない時は

もしクイックフィックスをした時にimportが候補に出ない時はts.config.jsonを確認してください。

"moduleResolution": "node",

moduleResolutionbundlerになっているとimportされないので、nodeに修正してみてください。

おわりに

この記事での質問や、間違っている、もっといい方法があるといったご意見などありましたらご指摘していただけると幸いです。

最後まで読んでいただきありがとうございました!

参考

3
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
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?