Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(868)

Unified Diff: sky/sdk/lib/widgets/README.md

Issue 1233703003: add initState, rename animated_container (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: remove print statement Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/sdk/lib/widgets/README.md
diff --git a/sky/sdk/lib/widgets/README.md b/sky/sdk/lib/widgets/README.md
index e6077549058503d59689efd9f0cdb3ab8b7f3ea7..478b64393227c545f2cf1a9711d7e3d824bd5c81 100644
--- a/sky/sdk/lib/widgets/README.md
+++ b/sky/sdk/lib/widgets/README.md
@@ -335,7 +335,7 @@ Let's walk through the differences in `MyDialog` caused by its being stateful:
components created by the parent component are retained in the widget
hierchy. Old _stateful_ components, however, cannot simply be discarded
because they contain state that needs to be preserved. Instead, the old
- stateful components are retained in the widget hiearchy and asked to
+ stateful components are retained in the widget hierarchy and asked to
`syncFields` with the new instance of the component created by the parent in
its `build` function.
@@ -386,6 +386,22 @@ subscriptions to event streams from outside the widget hierachy. When overriding
either `didMount` or `didUnmount`, a component should call its superclass's
`didMount` or `didUnmount` function.
+initState
+---------
+
+The framework calls the `initState` function on stateful components before
+building them. The default implementation of initState does nothing. If your
+component requires non-trivial work to initialize its state, you should
+override initState and do it there rather than doing it in the stateful
+component's constructor. If the component doesn't need to be built (for
+example, if it was constructed just to have its fields synchronized with
+an existing stateful component) you'll avoid unnecessary work. Also, some
+operations that involve interacting with the widget hierarchy cannot be
+done in a component's constructor.
+
+When overriding `initState`, a component should call its superclass's
+`initState` function.
+
Keys
----

Powered by Google App Engine
This is Rietveld 408576698