Skip to content

Instantly share code, notes, and snippets.

@urmastalimaa
Created April 29, 2016 09:59
Show Gist options
  • Save urmastalimaa/c160c8afefb2aaf1de1dd25b94ed5416 to your computer and use it in GitHub Desktop.
Save urmastalimaa/c160c8afefb2aaf1de1dd25b94ed5416 to your computer and use it in GitHub Desktop.
Embrace Simplicity
// What is the actual meaning of this function?
const mapStateToProps = (state) => {
return {
words: state.remoteGame.words,
currentInput: state.remoteGame.currentInput,
pastInput: state.remoteGame.pastInput
}
}
// Extract the `words`, `currentInput`, `pastInput` properties from `remoteGame` property of the parameter
const betterMapStateToProps = R.compose(
R.pick(['words', 'currentInput', 'pastInput']),
R.prop('remoteGame')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment