Skip to content

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

Closed
wants to merge 2 commits into from

Conversation

prof-xed
Copy link

This Update is based on #238
Needs a review in order of a parts are not possible to cover, and spell/grammar checking.

@@ -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
Copy link
Member

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:

  1. Class properties, eg: state = { myThing: true }` inside the class directly
  2. 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?**
Copy link
Member

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)
Copy link
Member

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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs capitalisation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants