Skip to content

Instantly share code, notes, and snippets.

@Swizec
Created May 23, 2016
Embed
What would you like to do?
// 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