import React, { cloneElement, PropTypes } from 'react'; import { compose } from 'redux'; import { contain } from 'redux-epic'; import { connect } from 'react-redux'; import { createSelector } from 'reselect'; import { LinkContainer } from 'react-router-bootstrap'; import PureComponent from 'react-pure-render/component'; import { Button, Row, Col } from 'react-bootstrap'; import ListJobs from './List.jsx'; import { findJob, fetchJobs } from '../redux/actions'; const mapStateToProps = createSelector( state => state.entities.job, state => state.jobsApp.jobs, (jobsMap, jobsById) => ({ jobs: jobsById.map(id => jobsMap[id]) }) ); const bindableActions = { findJob, fetchJobs }; const fetchOptions = { fetchAction: 'fetchJobs', isPrimed({ jobs }) { return jobs.length > 1; } }; export class Jobs extends PureComponent { static displayName = 'Jobs'; static propTypes = { push: PropTypes.func, findJob: PropTypes.func, fetchJobs: PropTypes.func, children: PropTypes.element, jobs: PropTypes.array, showModal: PropTypes.bool }; createJobClickHandler() { const { findJob } = this.props; return (id) => { findJob(id); }; } renderList(handleJobClick, jobs) { return ( ); } renderChild(child, jobs) { if (!child) { return null; } return cloneElement( child, { jobs } ); } render() { const { children, jobs } = this.props; return (

Hire a JavaScript engineer who's experienced in HTML5, Node.js, MongoDB, and Agile Development.

{`

We hired our last developer out of Free Code Camp and couldn't be happier. Free Code Camp is now our go-to way to bring on pre-screened candidates who are enthusiastic about learning quickly and becoming immediately productive in their new career.

Michael Gai, CEO at CoNarrative
{ this.renderChild(children, jobs) || this.renderList(this.createJobClickHandler(), jobs) } ); } } export default compose( connect(mapStateToProps, bindableActions), contain(fetchOptions) )(Jobs);