2016-09-25 2 views
0

React 's this에 대한 반응 API 규칙은 무엇입니까?React API에 대한 React API 규칙 - 어디입니까?

https://github.com/japgolly/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. 

그들이에 규칙의 어떤 종류를 참조 할이 코드를 이해하려고 노력하고 있기 때문에

나는이 물어 무엇입니까? 어디서 그 규칙을 읽을 수 있습니까?


이것은 구글이 제공하는 가장 가까운 일 :

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

규칙 여기 어딘가에 있습니까?

아니면 이거니?

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

+0

나는 이것을 이해하기 시작합니다. 각 lifeCycle 상태는 특정 유형의 범위와 연결됩니다. https://github.com/japgolly/scalajs-react/blob/master/doc/TYPES.md – jhegedus

답변

0

는 내가 대답, 확실하지 그래도,이 대답은 아마 개선 될 필요가 100 % 생각 여기에 문서화합니다.

범위가 무엇을 의미하는지 이해하는 열쇠

은 여기에 있습니다 :

https://github.com/japgolly/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. 

그래서 각각의 범위는 라이프 사이클 "상태"에 해당합니다.

관련 문제