これは
Reactのガイドを読んでいく記事です。
ガイドのリンク
フックのルール
ESLint プラグイン
昨日話題に出ていたルールを適用しやすくするためのプラグイン
Create React App で実行した場合はデフォルトで含まれているらしく、それ以外の場合意識すべきものらしい。
npm install eslint-plugin-react-hooks --save-dev
// Your ESLint configuration { "plugins": [ // ... "react-hooks" ], "rules": { // ... "react-hooks/rules-of-hooks": "error", // Checks rules of Hooks "react-hooks/exhaustive-deps": "warn" // Checks effect dependencies } }
あることを知っていれば意識しなくても使える仕組みがあるのは便利ですね。
今日はここまで。