Skip to content

Instantly share code, notes, and snippets.

@mikeyamadeo
Created September 15, 2015 17:15
Show Gist options
  • Save mikeyamadeo/dc56697d229860e4dc77 to your computer and use it in GitHub Desktop.
Save mikeyamadeo/dc56697d229860e4dc77 to your computer and use it in GitHub Desktop.
render () {
const { data, renderAs } = this.props
const types = {
listing: JobListing,
heading: JobHeading,
card: JobCard
}
const component = types[renderAs] // this one will NOT work
const $component = types[renderAs] // this one WILL
return (
<div>
<component data={data} />
<$component data={data} />
</div
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment