Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

add lifecycle example in docs#564

Merged
wuct merged 1 commit intoacdlite:masterfrom
pokorson:add_lifecyle_example
Nov 20, 2017
Merged

add lifecycle example in docs#564
wuct merged 1 commit intoacdlite:masterfrom
pokorson:add_lifecyle_example

Conversation

@pokorson
Copy link
Copy Markdown

Hello,

What do you think about adding example for lifecycle usage. When I first used it, it wasn't clear that I should use this inside spec methods.
Also is there a reason for defining lifecycle like this? It feels strange to use this in all this functional composition. I was thinking if it would be better if spec functions would get props and some setState equivalent method as arguments? It will increase API surface but I think it would be more consistent with other methods.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Nov 14, 2017

Codecov Report

Merging #564 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #564   +/-   ##
=======================================
  Coverage   88.37%   88.37%           
=======================================
  Files          49       49           
  Lines         370      370           
=======================================
  Hits          327      327           
  Misses         43       43

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ea02b14...ea0f97f. Read the comment docs.

@wuct
Copy link
Copy Markdown
Contributor

wuct commented Nov 15, 2017

You are right. lifecycle is a weird part in Recompose, which has been discussed in #500, and probably will be deprecated in the future.

@pokorson
Copy link
Copy Markdown
Author

@wuct will you consider merging just doc example?

Copy link
Copy Markdown
Contributor

@wuct wuct left a comment

Choose a reason for hiding this comment

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

Just do some linting and I'll merge it.

docs/API.md Outdated

Example:
```js
const PostsList = ({posts}) => (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

({ posts })

componentDidMount() {
API.fetchPosts().then(posts => {
this.setState({posts: posts});
})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fetchPosts().then(posts => {
  this.setState({ posts });
})

@pokorson
Copy link
Copy Markdown
Author

@wuct fixed

@wuct
Copy link
Copy Markdown
Contributor

wuct commented Nov 20, 2017

Thank you!

@wuct wuct merged commit f4745a0 into acdlite:master Nov 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants