Skip to content
This repository has been archived by the owner on Feb 10, 2020. It is now read-only.

setState in onEnd() #16

Open
atoulous opened this issue Dec 4, 2017 · 0 comments
Open

setState in onEnd() #16

atoulous opened this issue Dec 4, 2017 · 0 comments

Comments

@atoulous
Copy link

atoulous commented Dec 4, 2017

Hello alex!

Thanks for the package, it's works well for me.

I had one question, what's the way to 'setState' in function onEnd of Cards component?

The code looks like that in my onEnd():

if (action === 'end') {
    this.setState({ users: null });
}

but i had this warning that informs me i updated state in unmounted component (in your SwipeCards):

Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the SwipeCards component.

My point is I want to setState my current component, that contains Cards && Card, in onEnd function to re-render my view with updates without warnings, any idea ? 😃

@atoulous atoulous changed the title <Cards onEnd={() => ()} /> setState in onEnd() Dec 4, 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

No branches or pull requests

1 participant