You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
ある程度Babelとか知ってる人向きです。 要約 Class Property DeclarationsでReactのPropTypes指定が捗る ESLintそのままではClass Property Declarationsに対応してない babel-eslintパーサ使えば解決(ただしestraverse-fbは手動で入れろ) 以上。estraverse-fb周りはそのうち修正されそう。 Class Property DeclarationsでReactのPropTypes指定が捗る ES.nextのClass Property Declarationsでクラスにプロパティ生やせるよう提案されている。 それを使えばReactのpropTypes指定が捗るようになる。やったぜ。 import React from 'react'; export default class MyButto
FlowTypeが気になっているので、Visual Studio CodeでFlowの型チェックを表示する方法を調べました。プラグインをインストールすると、Flowのエラーをエラーパネルに表示できます。 1. [View]→[Command Pallet]でコマンドパレットを開き、「Extensions」と入力して[Extensions : Install Extensions]を矢印カーソルで選び、エンターキーで決定する。 2. 拡張機能の一覧画面が表示されるので、「flow」と入力し、「Flow Language Support」をクリックする。 3. [Install]ボタンを押し、インストールする。 4. [Code]→[Preferences]→[Settings]→[WORKSPACE SETTINGS]をクリックする。[.vscode/settings.json]の編集ができ
TL;DR onChangeの引数にEventではなくSyntheticInputEventを使う https://github.com/facebook/flow/issues/218 これまでのやり方 たとえばこんな、テキストを入力して反映するだけのコンポーネント。 /* @flow */ import React from 'react' class InputField extends React.Component { state: { text: string } constructor(props) { super(props) this.state = { text: '' } } handleChange(e : Event) { const text = e.target.value // error! this.setState({text}) } render()
Quick post that documents the various quirks of `propTypes`. The React `propTypes` semantics differ from the ones from Flow and can cause subtle bugs. Here’s a handy cheat sheet. PropTypespropTypes: { // field required, must be number and NOT `null` NOR `undefined` foo: PropTypes.number.isRequired } propTypes: { // field can be omitted; if provided, can be number OR `null` OR `undefined` foo: Prop
ということで、前回に引き続きReact Confで紹介されてたものを試すシリーズの第二回です。 flowの簡単な設定とeslint/babel/precommitフック/vimとの連携のみです。深い使い方は(今のところは?)書きません。flowは既に色々なところで紹介されてますが、気にせず行きます。 ちなみに今回もReactは出てきません。(追記で少しだけ触れてしまいました) flowとは JavaScript用のtypeチェッカー ファイル単位で適用できるため、既存のプロジェクトにも気軽に導入できる eslintやbabelとも連携できるので既存プロジェクトに導入しやすい 色んなエディタ/IDEでもサポートされている この辺を見る限りFacebookのデベロッパ的にはTypeScriptはあんまり推奨してないっぽい GitHubのstarヒストリーを見る限りはTypeScriptに分があ
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く