acdlite / recompose

A React utility belt for function components and higher-order components.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make lifecycle more functional than what it currently is

alaboudi opened this issue · comments

I want to suggest a new way to invoke the lifecycle HOC.

Instead of using the lifecycle hook this way

lifecycle({
 componentDidMount() {
  this.setState({someKey: this.props.someValue});
 }
});

the below code is more functionally aligned with the rest of the library

lifecycle({
 componentDidMount: (state, props) => {
  props.someStateHandler(props.someValue);
 }
})

After observing the internals of how lifecycle works, its very easy to do this change and I can volunteer to do it. It's just a question of whether you guys think this is a good idea or not. Cheers

commented

I'm going to close this issue because it's better to consolidate discussion under one issue.