0

React の this の反応 API ルールは何ですか?

私はこのコードを理解しようとしているので、これを尋ねています:

https://github.com/japgoly/scalajs-react/blob/master/core/src/main/scala/japgolly/scalajs/react/types.scala#L8

それが書かれている場所:

 * Here we break React's `this` into tiny little bits, then stitch them together to use type-safety to enforce the
 * rules documented in the React API.

彼らはどのような規則を参照していますか? これらのルールはどこで読めますか?


これは、Googleが提供する最も近いものです:

https://facebook.github.io/react/docs/top-level-api.html

ルールはここのどこかにありますか?

それともこれですか?

https://facebook.github.io/react/docs/component-specs.html

4

1 に答える 1

0

私が答えだと思うことをここに文書化したいのですが、100%確実ではありませんが、この答えはおそらく改善する必要があります。

Scope の意味を理解するための鍵は次のとおりです。

https://github.com/japgoly/scalajs-react/blob/master/doc/TYPES.md

つまり、このテーブル:

Type                                 Desc
CompScope.DuringCallbackU[P, S, +B] An unmounted component's this scope.
CompScope.DuringCallbackM[P, S, +B] A mounted component's this scope.
CompScope.WillUpdate[P, S, +B, +N]  A component's this scope during componentWillUpdate.
BackendScope[P, S]                  A component's this scope as is available to backends.

したがって、各スコープはライフサイクルの「状態」に対応します。

于 2016-09-25T06:37:43.780 に答える