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

Use prev/current decision data when updating #4

Merged
merged 1 commit into from
Apr 13, 2019

Conversation

mattrothenberg
Copy link
Owner

For context: aholachek/react-flip-toolkit#71

Now that the onUpdate function from react-flip-toolkit accepts previous + current decision data as an argument, consumers can more easily write shouldFlip and shouldInvert functions in their Flipped components.

shouldFlip(index) {
  return (prev, current) => {
    // Before, consumers had to cache "prev"
    // somewhere in this component's state
    return index === prev || index === current;
  };
},

@mattrothenberg mattrothenberg merged commit 60bc386 into master Apr 13, 2019
@mattrothenberg mattrothenberg deleted the support-decision-data branch April 13, 2019 16:52
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.

1 participant