Skip to content

Instantly share code, notes, and snippets.

View mikeyamadeo's full-sized avatar

Pixel mikeyamadeo

View GitHub Profile
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 (
render () {
const { data, renderAs } = this.props
const types = {
listing: JobListing,
heading: JobHeading,
card: JobCard
}
const render = {
me: types[renderAs]
}
import React from 'react'
import JobListing from './components/org.JobListing'
import JobHeading from './components/org.JobHeading'
import JobCard from './components/org.JobCard'
// well this is repetitive :/....
const renderAs = {
listing (data) {
return <JobListing data={data} />
},
import React from 'react'
import Job from 'JobComponent'
const jobData = {
title: "Looking for help",
employerId: "uniqueId"
}
const JobRenderTypes = React.createClass({
render () {
.Btn {
padding: .8em 1.5em;
color: white;
background-color: #EC87C0;
border: none;
}
.disabled {
background-color: #BBBBBB;
}
import style from './style'
import CSSModules from 'react-css-modules'
import React from 'react'
/**
* Notice use of `styleName` vs. `className`
*/
const Btn = React.createClass({
render () {
return (
import style from './style'
import React from 'react'
const Btn = React.createClass({
render () {
return (
<button className={style.Btn}>
Submit
<button>
)
render () {
return (
<button className='Btn'>
Submit
</button>
)
}
.Btn {
padding: .8em 1.5em;
color: white;
background-color: #EC87C0;
border: none;
}
@mikeyamadeo
mikeyamadeo / imperative_vs_declarative_react.md
Created August 14, 2015 19:14
imperative vs declarative functions w/ react
  renderThings () {
    return this.props.things.map(thing => {
      return <li>{thing.name}</li>
    })
  },

 render () {