的规则是什么?
我之所以问这个问题,是因为我试图理解这段代码:
所写的地方:
* 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
规则在什么地方吗?
还是这个?
发布于 2016-09-25 06:37:43
我想在这里记录一下我认为的答案,而不是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.因此,每个作用域对应于一个lifeCycle“状态”。
https://stackoverflow.com/questions/39683919
复制相似问题