-
Notifications
You must be signed in to change notification settings - Fork 721
Update W2-lesson-plan.md #239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This Update is based on HackYourFuture#238
@@ -9,12 +9,21 @@ | |||
- Lifecycle methods are used when render is not enough on its own | |||
|
|||
- Cover each, giving examples of when they might be useful | |||
- componentWillMount: SSR | |||
- constructor: initializing state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A constructor
is not a lifecycle method. It shouldn't be included here, it will confuse students. As you know, constructors
are pure JS.
I believe it's specifically mentioned elsewhere in the curriculum I wrote that state can be initialised in two ways:
- Class properties, eg:
state = { myThing: true
}` inside the class directly - The
constructor
, as you say here.
Generally class properties can be used for simple initialisation. Facebook uses class properties in their internal source code - it's not something controversial like decorators.
A constructor
can be used to initialise state when you need more complicated logic (checking other data stores, cookies, localStorage, etc).
- Cover how the lifecycle methods invoking order by react component in [this lifecycle diagram](http://projects.wojtekmaj.pl/react-lifecycle-methods-diagram/) the docs mentioned to. | ||
|
||
|
||
**Can the answer on these questions possible?** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change to: "Can we answer these questions?"
|
||
|
||
**Can the answer on these questions possible?** | ||
- in which of these lifecycle methods is it OK to call setState? (watch out for stack overflows) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs capitalisation.
|
||
**Can the answer on these questions possible?** | ||
- in which of these lifecycle methods is it OK to call setState? (watch out for stack overflows) | ||
- what methods are invoked on each component lifecycle: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs capitalisation.
This Update is based on #238
Needs a review in order of a parts are not possible to cover, and spell/grammar checking.