Skip to content
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

Add lifecycle props to Container #7

Closed
diegohaz opened this issue Apr 14, 2018 · 0 comments
Closed

Add lifecycle props to Container #7

diegohaz opened this issue Apr 14, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@diegohaz
Copy link
Owner

diegohaz commented Apr 14, 2018

I'm having to use lifecycles often. I think it might be a good idea to implement something like https://github.com/reactions/component.

const increment = amount => state => ({ count: state.count + amount });

const CounterContainer = props => (
  <Container 
    initialState={{ count: 0 }}
    onMount={({ setState }) => setState(increment(10))} // componentDidMount
    onUpdate={({ setState }) => setState(increment(10))} // setState call
    onUnmount={({ setState }) => setState(increment(10))} // componentWillUnmount
    actions={{ increment }}
    {...props}
  />
);
@diegohaz diegohaz added the enhancement New feature or request label Apr 14, 2018
@diegohaz diegohaz changed the title Add lifecycle props to State Add lifecycle props to Container Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant