LoginSignup
5
1

More than 5 years have passed since last update.

JSXでのbooleanのattribute(属性)表記

Posted at

きっかけ

react-nativeのプロジェクトでESLint当てて書いているときにboolean型でwarning吐かれました。
ESLint見てみると、booleanの属性表記について書かれていたので、メモを残しておきます。

attribute(属性)表記について

参考のURLのESLintの設定を見ればわかるが、以下のどっちも書ける。

var Hello = <Hello personal={true} />;

var Hello = <Hello personal />;

ESLint内でreact/jsx-boolean-valueの設定を"always"と"never"で切り替えるのみで、ルールを変更できる。
詳しくは、参考URL見てください。

参考

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