Created
May 23, 2016 23:15
-
-
Save Swizec/f53c15cf68166295f19bc7e70ed31db1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Contrived example of destructuring objects where local context has different name for keys | |
// Think of it as "When giving a value, the context has a different name for it than when getting the value" | |
// LabelX becomes just X when you're a label. | |
// There are many reasons why this isn't (and maybe shouldn't be) possible | |
let makeInput = ({x, value}) => ( | |
<DoInputStuff /> | |
) | |
let makeLabel = ({x, label}) => ( | |
<DoLabelStuff /> | |
) | |
// params = {labelX: 50, inputX: 500, value: .., label: ...} | |
let makeLabeledInput = (params) => ( | |
makeLabel(params); | |
makeInput(params); | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment